instanceof Object

../_images/instanceof_class.png

object is a type, but it can also be used as a constant name. Then, instanceof accepts it for testing a variable.

There are some other cases around instanceof, which are surprising upon first read.

It is possible to use a string or an object in a variable, but not a direct string, a constant nor a ::class.

See Also

PHP Features