ネームスペースの利点はこれだと思っている。

20190302

Logging

ネームスペースの利点はこれだと思っている。
複数人で開発とかしているときに関数名やクラスなどが
かぶってしまう可能性ある、そういうのを
解決してくれるのがネームスペースということです。

<?php
namespace testdemo;
class test{
    function demo():string
    {
        return "demo1n";
    }
}
namespace testdemo2;
class test{
    function demo():string
    {
        return "demo2n";
    }
  }

 

<?php
include_once "./index-6.php";
$demo = new  testdemotest();
print $demo->demo();
$demo = new  testdemo2test();
print $demo->demo();

コメントは受け付けていません。

タグ

'dem, , 2, 6, class, demo, function, include, index, lt, namespace, nbsp, new, once, php, print, return, string, test, クラス, こと, これ, スペース, とき, ネーム, 利点, 可能性, 複数人, 解決, 開発, 関数,