The get_class() function gets the name of the class of an object. It returns FALSE if object is not an object. If object is excluded when inside a class, the name of that class is returned.
Syntax
get_class(object)
Parameters
object − The tested object. You can avoid this parameter inside the cass.
Return
The get_class() function returns the name of the class of an object. It returns FALSE if object is not an object. If object is excluded when inside a class, the name of that class is returned.
Example
The following is an example −
<?php class Demo { function Demo() { } function name() { echo "Internal call: " , get_class($this) , "\n"; } } // create an object $two = new Demo(); // external call echo "External call: " , get_class($two) , "\n"; // internal call $two->name(); ?>
Output
External call: Demo Internal call: Demo