php method to determine which class an object is derived from
This article describes the example of php method to determine which class an object is derived from. Share it with everyone for your reference. The specific implementation method is as follows:
?
1
2
3
4
5
6
7
|
$th = new Thread; //创建新对象
if ($th instanceof Thread) //如果对象$th是Thread类型的,则输出Yes
echo "Yes";
else
echo "No";
?>
|
1
2
3
4
5
6
7
|
$th = new Thread; //Create new object
if ($th instanceof Thread) //If the object $th is of type Thread, output Yes
echo "Yes";else<🎜>
<🎜>echo "No";<🎜>
<🎜>?>
|
I hope this article will be helpful to everyone’s PHP programming design.
http://www.bkjia.com/PHPjc/1020293.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1020293.htmlTechArticlephp method to determine which class an object is derived from. This article describes the php method to determine which class an object is derived from. . Share it with everyone for your reference. The specific implementation method is as follows: ? 1...