Home  >  Article  >  Backend Development  >  Detailed explanation of the use of PHP class related functions_PHP tutorial

Detailed explanation of the use of PHP class related functions_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:11:07812browse

bool class_alias ( string $original , string $alias [, bool $autoload = TRUE ] ) — Create an alias for a class
bool class_exists ( string $class_name [, bool $autoload ] ) — Check whether the class has been defined
string get_called_class ( void ) — Get the class name of the static method call

Copy Code The code is as follows:

class foo {
static public function test(){
var_dump(get_called_class());
}
}
class bar extends foo {}
foo::test();
bar::test();

array get_class_methods ( mixed $class_name )—Returns an array
array get_class_vars ( string $class_name )— Returns an array
string get_class ([ object $obj ] )—Returns the class name of the object
array get_declared_classes ( void )— Returns an array
array get_declared_interfaces ( void )—Returns an array of names of all declared interfaces in the current script
array get_object_vars ( object $obj )— Returns an associative array
string get_parent_class ([ mixed $obj ] ) — Returns the parent class name of the object or class
bool interface_exists ( string $interface_name [, bool $autoload ] ) — Checks whether the interface has been defined
bool is_a ( object $object , string $class_name ) — Returns TRUE if the object belongs to this class or this class is the parent class of this object
bool is_subclass_of ( object $object , string $class_name )—Check that the object is instantiated by a subclass of this class
bool method_exists ( object $object , string $method_name )—Check whether the method of the class exists
bool property_exists ( mixed $class , string $property ) — Checks whether an object or class has the property

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326986.htmlTechArticlebool class_alias ( string $original , string $alias [, bool $autoload = TRUE ] ) — Created for a class Alias ​​bool class_exists ( string $class_name [, bool $autoload ] ) — Check for class...
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