PHP | get_called_class() Function Last Updated : 27 Apr, 2020 Comments Improve Suggest changes Like Article Like Report The get_called_class() function is an inbuilt function in PHP which is used to get the class name where the static method is called. Syntax: string get_called_class( void ) Parameters: This method does not accept any parameter. Return Value: This function returns the class name on success and returns False if it is called from outside a class. Below programs illustrate the get_called_class() function in PHP: Program 1: php <?php // Create a class class GFG { public $Geek_name = "Welcome to GeeksforGeeks"; public function Geeks() { var_dump(get_called_class()); } } GFG::Geeks(); ?> Output: string(3) "GFG" Program 2: php <?php // Create a class class GFG { public function Geeks() { var_dump(get_called_class()); } public function GeeksforGeeks() { var_dump(get_called_class()); } } GFG::Geeks(); GFG::GeeksforGeeks(); class_alias('GFG', 'GeeksforGeeks'); GeeksforGeeks::Geeks(); GeeksforGeeks::GeeksforGeeks(); ?> Output: string(3) "GFG" string(3) "GFG" string(3) "GFG" string(3) "GFG" Reference: https://www.php.net/manual/en/function.get-called-class.php Create Quiz Comment A ashokjaiswal Follow 0 Improve A ashokjaiswal Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP-OOP 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