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_parents() Function neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-SPL-Functions Similar Reads PHP | get_class() Function The get_class() function is an inbuilt function in PHP which is used to return the class name of an object. Syntax: string get_class( object $object ) Parameters: This function accepts single parameter $object which holds the object that need to be tested. The value of this parameter can be omitted 1 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 | parse_url() Function The parse_url() function is an inbuilt function in PHP which is used to return the components of a URL by parsing it. It parses an URL and return an associative array which contains its various components. Syntax: parse_url( $url, $component = -1 ) Parameters: This function accepts two parameters as 2 min read PHP | opendir() Function The opendir() function in PHP is an inbuilt function which is used to open a directory handle. The path of the directory to be opened is sent as a parameter to the opendir() function and it returns a directory handle resource on success, or FALSE on failure. The opendir() function is used to open up 2 min read PHP | imagesy() Function The imagesy() function is an inbuilt function in PHP which is used to return the height of the given image. Syntax: int imagesy( $image ) Parameters: This function accepts single parameters $image which is mandatory. This $image variable store the image created by imagecreatetruecolor() image creati 1 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 PHP hypot() function The hypot() function is a built-in mathematical function in PHP and returns the square root of sum of square of arguments passed. It finds the hypotenuse, hypotenuse is the longest side of a right angled triangle. It is calculated by the formula : h = \sqrt{x^2+y^2} where x and y are the other two s 1 min read PHP Arrow Functions PHP arrow functions are a shorthand syntax for anonymous functions. It was introduced in PHP 7.4, which provides a shorter way to write anonymous functions. They allow you to create functions with fewer lines of code while maintaining functionality. They provide an easy-to-read syntax, particularly 5 min read Like