php method to determine which class an object is derived from, php to determine which class an object is derived from
The example in this article describes the method in php to determine which class an object is derived from. Share it with everyone for your reference. The specific implementation method is as follows:
<?php
$th = new Thread; //创建新对象
if ($th instanceof Thread) //如果对象$th是Thread类型的,则输出Yes
echo "Yes";
else
echo "No";
?>
Copy after login
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/1019433.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1019433.htmlTechArticlephp method to determine which class the object is derived from, php determines the object is derived. This article tells the example of php determining whether the object is derived. method from which class. Share it with everyone for your reference. Specific implementation...