4 ms·
Your PHP example is possible to write in a way that is nearly identical to the C# you provided. Why are you prefixing Namespace\MyClass(); when you declared you
by ary 16y ago
Your PHP example is possible to write in a way that is nearly identical to the C# you provided. Why are you prefixing Namespace\MyClass(); when you declared your namespace scope in 'use \My\Namespace'? Your assignment can just be:
$var = new MyClass();
This brings it pretty much in line with your C# example. Have you read the PHP docs on namespaces?
http://www.php.net/manual/en/language.namespaces.basics.php http://www.php.net/manual/en/language.namespaces.basics.php
- acabal 16y agoThat's the point; the PHP doesn't compile without the namespace prefix. In fact I just tried it to make sure I'm remembering right.
- ary 16y agoI was taken aback when I tested this for myself as my initial reading of the PHP docs lead me to a very different conclusion. You are indeed correct, and in my opinion that is very broken. Touché.