Home >Backend Development >PHP Tutorial >PHP method to determine which class an object is derived from_PHP tutorial

PHP method to determine which class an object is derived from_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 09:49:10987browse

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

45 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...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn