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

2019.03.02

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();

著者名  @taoka_toshiaki

※この記事は著者が30代前半に書いたものです.

Profile
高知県在住の@taoka_toshiakiです、記事を読んで頂きありがとうございます.
数十年前から息を吸うように日々記事を書いてます.たまに休んだりする日もありますがほぼ毎日投稿を心掛けています😅.
SNSも使っています、フォロー、いいね、シェア宜しくお願い致します🙇.
SNS::@taoka_toshiaki

タグ

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