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 Create Quiz Comment N neeraj3304 Follow 0 Improve N neeraj3304 Follow 0 Improve Article Tags : PHP PHP-function PHP-SPL-Functions Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like