Thiemos Archiv
- Thursday, 2016-03-10 09:57
- PHP 5.5 is weird:use NonExistingNamespace\NonExistingClass;Result:
$className = NonExistingClass::class;
var_dump( $className );string(37) "NonExistingNamespace\NonExistingClass"
. What this means: PHP does not care if the class exists. It does not care if a class mentioned in ause
clause exists and it does not care if::class
is used on an existing class. Ause
clause does nothing but create an entry in a string map, mapping short to full qualified class names. The::class
syntax does nothing but returning a string from that map. That's all. Kommentare zu diesem Beitrag können per E-Mail an den Autor gesandt werden.
So PHP is still that same old thing with it's strange hammers and stuff. Even in "new" Versions that always claim to be "better"
not that surprising.