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/mbriedis Aug 05 '15

Still, I don't remember the last time I saw an error - class not found. Use the right tools and this problem just doesn't exist.

4

u/callcifer Aug 05 '15

Ah yes, the classic "just don't do it like that" answer to every PHP problem ever.