PHP Type Operator
What are the Type Operator?
Explanation
The only PHP type operator: instanceof is used to determine whether a given object, its parents or their implemented interfaces are of a specified object class.Before this is_a() was used but is_a() has been deprecated in favor of instanceof.
Example :
<?php
class A { }
class B { }
$like = new A;
if ($like instanceof A)
{
echo 'A';
}
if ($like instanceof B)
{
echo 'B';
}
?>
Result :
A
In the above example like is an object of class A, so "A" is displayed as answer