Example using Namespace in PHP…
use \MyLibrary\Registry;
use \MyLibrary\User;
use \MyLibrary\Request;
namespace MyLibrary\Base
{
class Base
{
public $registry;
function __construct($registry)
{
$this->registry = $registry;
$this->user = New User;
$this->request = new Request;
# code...
}
}
}
Now in C# the Namespace separator is more like this…
using MyLibrary.Registry;
using MyLibrary.User;
using MyLibrary.Request;
namespace MyLibrary.Base
{
public partial class Base
{
public MyFunction(registry)
{
Code here
}
}
}
So I know there is a lot of complaints on the PHP namespace separator, so bad that some people don’t even use them because they hate the current backslash.
So I am curious, is there any way possible to Define your own Namespace separator to be used in PHP?
I’m afraid you can’t, it’s hard-wired into the language. Such a thing would be really difficult to do anyway, as other symbols already have meanings assigned to them in PHP (. is string concatinate, / is divide, * is multiply, etc).