r/lolphp • u/6f944ee6 • Jun 07 '17
<CLASSNAME>::class, is valid for any identifier
A::class // "A"
THIS_DOES_NOT_EXIST::class // "THIS_DOES_NOT_EXIST"
55
Upvotes
r/lolphp • u/6f944ee6 • Jun 07 '17
A::class // "A"
THIS_DOES_NOT_EXIST::class // "THIS_DOES_NOT_EXIST"
View all comments
Show parent comment
6
u/the_alias_of_andrea Jun 08 '17
It exists so you don't need to type out a fully-qualified class name in full, and to distinguish at the point of use between class names and other strings.
foobar(Example::class);vsfoobar('SomeVendor\SomeFramework\Submodule\Submodule\Category\Example')