instanceof Expect Objects

PHP used to report a fatal error when provided with a value that is not an object. After PHP 7.3, it would return false in such case, and not break the execution.

PHP code

<?php

var_dump(null instanceof Countable);

?>

Before

PHP Fatal error:  instanceof expects an object instance, constant given in /codes/instanceofExpectObjects.php on line 3

Fatal error: instanceof expects an object instance, constant given in /codes/instanceofExpectObjects.php on line 3

After

bool(false)

PHP version change

This behavior changed in 7.3

See Also

Error Messages