In general PHP instanceof and is_a () function is the same, the difference is due to PHP version different, some PHP version of the is_a () discarded. In this paper, we will analyze the difference between instanceof and is_a () in PHP.
Both the instanceof operator and the Is_a () method are judged whether an object belongs to the class or the class is the parent of this object (used to determine whether a PHP variable belongs to an instance of a class class)
Yes returns TRUE if not, returns FALSE
Difference:
The instanceof operator was introduced in PHP 5. Before this, is_a () was used, but later is_a () was discarded and replaced with instanceof.
Attention:
PHP 5.3.0, and resumed using Is_a ().
Summarize:
PHP's service environment is now generally used php5.0+, so try to use instanceof instead of is_a ()
In summary, if you do not know your server environment, then it is recommended that you use instanceof, so as not to cause unnecessary trouble
Related recommendations:
PHP function Note
PHP basic built-in function PHP function return value PHP array php date Letter
PHP version explained _php