1. Interface_exists, Class_exists, Method_exists and property_exists: As the name implies, you can guess a few of their functions from the names of the above functions. I think that's why I'm becoming more and more fond of this programming language as I learn more about PHP. Let's start with their prototype declaration and brief description, and more or just look at the example code. BOOL Interface_exists (String $interface _name [, bool $autoload = True]) determines whether the interface exists, and the second parameter indicates whether __autoload is executed when the lookup is performed. BOOL Class_exists (String $class _name [, bool $autoload = True]) determines whether a class exists, and the second parameter indicates whether __autoload is executed on lookup. BOOL Method_exists (mixed $object, string $method _name) determines whether the specified class or object contains the specified member function. BOOL Property_exists (mixed $class, string $property) determines whether the specified class or object contains the specified member variable. $value) {print ' $key = '. $key. ' = = $value = '. $value. " \ n "; }} class TestClass {public $publicVar = 1; private $privateVar = 2; static private $staticPrivateVar = "Hello"; static Pu Blic $staticPublicVar; Private Function Privatefunction () {} function Publicfunction () {Output_array ("Get_class_methods", Get_class_methods ( __class__)); Output_array (' Get_class_vars ', Get_class_vars (__class__)); Output_array (' Get_object_vars ', Get_object_vars ($this)); }} $TESTOBJ = new TestClass ();p rint "The following is output within testclass.\n"; $testObj->publicfunction (); Print "\nthe following is output out of testclass.\n"; Output_array (' Get_class_methods ', get_class_methods (' TestClass ') ); Output_array (' Get_class_vars ', Get_class_vars (' TestClass ')); Output_array (' Get_object_vars ', Get_object_vars ($ Testobj)); The results of the operation are as follows: bogon:testphp liulei$ PHP class_exist_test.php The following is output within Testclass.get_class_methods ... $key = 0 = + $value = Privatefunction$key = 1 = +/------$value= Publicfunctionget_class_vars .... $key = Publicvar = = = = = = = Privatevar = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 2$key $value Ublicvar = $value = 1$key = Privatevar = + $value = 2 The following is output out of testclass.get_class_methods .... .... $key = 0 = $value = publicfunctionget_class_vars ... $key = Publicvar = = = = =/=/= =/=/=/=/=/=/=/= 1$key = Staticpublicvar = + $value = get_object_vars ... $key = Publicvar = = = = = 1 4. $value = = =. Get_called_class and Get_class:string get_class ([Object $object = NULL]) Get the class name of the Parameter object. The current class name when a string get_called_class (void) static method is called.
http://www.bkjia.com/PHPjc/678024.html www.bkjia.com true http://www.bkjia.com/PHPjc/678024.html techarticle 1. Interface_exists, Class_exists, Method_exists and property_exists: As the name implies, you can guess a few of their functions from the names of the above functions. I think that's what I'm going to do with ...