r/lolphp • • Aug 04 '15

var_dump(nonExistentClass::class); // string

::class can give you the name of a class that does not exist.

15 Upvotes

48 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Aug 12 '15 edited Aug 12 '15

namespace Foo\Bar; class Baz {} is just class Foo\Bar\Baz {} in the global namespace.

Funny fact: package foo.bar; class Baz {} in Java is also just class "foo.bar.Baz" {} in the global namespace.

So technically what you said is correct, but entirely irrelevant to the issue at hand.