Details of the use of PHP class related functions

  • 2020-06-03 06:01:03
  • OfStack

bool class_alias (string $original, string $alias [, bool $autoload = TRUE]) - Creates an alias for 1 class
bool class_exists (string $class_name [, bool $autoload]) - Checks whether the class is defined
string get_called_class (void) - Gets the class name for the static method call

class foo {
    static public function test(){
class bar extends foo {}

array get_class_methods (mixed $class_name) - Returns an array of the class's method names
array get_class_vars (string $class_name) - Returns an array of default properties of the class
string get_class ([object $obj]) - Returns the class name of the object
array get_declared_classes (void) - Returns an array of the names of the defined classes in the current script
array get_declared_interfaces (void) - returns an array of the names of all declared interfaces in the current script
array get_object_vars (object $obj) - Returns an associative array of object attributes
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 or is the parent of the object
bool is_subclass_of (object $object, string $class_name) - The detection object is obtained by instantiating a subclass of the class
bool method_exists (object $object, string $method_name) - Checks whether a method of the class exists
bool property_exists (mixed $class, string $property) - Checks whether an object or class has this property

Related articles: