Php type operator instanceof looks like this in some php books. The instanceof operator is introduced in PHP5. Is_a () was used before, but is_a () is outdated. it is best to use instanc php type operator instanceof
The type operator instanceof does not seem to be mentioned in some php books. in the case of php, I just mentioned that I did not elaborate on it. I just excerpted it from the manual for remarks.
The instanceof operator is introduced in PHP 5. Is_a () was used before, but is_a () is outdated. it is best to use instanceof.
1. used to determine whether a variable belongs to an instance of a class;
2. it is used to determine whether a variable is an instance that inherits the subclass of a parent class;
3. it is used to determine whether a variable is an instance of an object that implements an interface.
Before PHP 5.1.0, if the class name to be checked does not exist, instanceof will call _ autoload (). In addition, a fatal error occurs if the class is not loaded. You can avoid this problem by using dynamic class reference or using a string variable containing the class name:
Example #6 avoid class name searches and fatal errors caused by instanceof in PHP 5.0
$ D = 'notmyclass ';
Var_dump ($ a instanceof $ d); // no fatal error here
?>