get_class

PHP 4, PHP 5, PHP 7, PHP 8
get_class - Returns the name of the class of an object
Manual
Code Examples

Example #1 Using get_class

Result: Its name is foo My name is foo
PHP Version:

Example #2 Using get_class in superclass

Result: string(3) "foo" string(3) "bar"
PHP Version:

Example #3 Using get_class with namespaced classes

Result: string(11) "Foo\Bar\Baz"
PHP Version:


Function get_class:

Class/Object Information Functions

Most used PHP functions