PHP class_parents() Function Last Updated : 28 Mar, 2023 Comments Improve Suggest changes Like Article Like Report The class_parents() function is an inbuilt function in PHP where the parent class for the given class will be returned. Syntax: class_parents( object|string $object_or_class, bool $autoload = true ): array|false Parameters: This function accepts two parameters that are described below: object_or_class: This parameter specifies the object(i.e. a class instance) or a string that has the class name.autoload: This parameter, by default, defines & calls the __autoload Return Value: If the function is successful then it will return an array otherwise it will return "false". Example 1: The code demonstrates the class_parents() functions PHP <?php class GFG {} class Article extends GFG{} { print_r(class_parents(new Article)); } ?> OutputArray ( [GFG] => GFG ) Example 2: The code demonstrates the class_parents() function. PHP <?php class GFG2 {} class Article extends GFG2{} {} $ob = new Article(); print_r(class_parents($ob)); ?> OutputArray ( [GFG2] => GFG2 ) Reference: https://www.php.net/manual/en/function.class-parents.php Comment More infoAdvertise with us Next Article PHP class_uses() Function N neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-SPL-Functions Similar Reads PHP | is_a() function The is_a() is a built-in function in PHP and is used to check whether a given object is of a given class or not. It also checks if the given class is one of the parents of the given object or not. Syntax: boolean is_a($object, $class) Parameters: This function accepts two parameters as shown in the 2 min read PHP | is_a() function The is_a() is a built-in function in PHP and is used to check whether a given object is of a given class or not. It also checks if the given class is one of the parents of the given object or not. Syntax: boolean is_a($object, $class) Parameters: This function accepts two parameters as shown in the 2 min read PHP class_uses() Function The class_uses() function is an inbuilt function in PHP where the traits utilized by the given class, will be returned. Syntax: class_uses($object_or_class,$autoload = true): array|false Parameters: This function accepts the two parameters that are described below object_or_class: The name of the cl 2 min read PHP | is_callable() Function The is_callable() function is an inbuilt function in PHP which is used to verify the contents of a variable can be called as a function. It can check that a simple variable contains the name of a valid function, or that an array contains a properly encoded object and function name. Syntax: bool is_c 2 min read PHP | is_callable() Function The is_callable() function is an inbuilt function in PHP which is used to verify the contents of a variable can be called as a function. It can check that a simple variable contains the name of a valid function, or that an array contains a properly encoded object and function name. Syntax: bool is_c 2 min read PHP method_exists() Function The method_exists() function is an inbuilt function in PHP which used to check the class method exists or not. It returns "true" if the method exists otherwise returns "false". Syntax: bool method_exists( object|string $object_or_class, string $method );Parameters: This function accepts two paramete 1 min read Like