get_class Returns the name of the class of an object &reftitle.description; stringget_class objectobject Gets the name of the class of the given object. &reftitle.parameters; object The tested object. This parameter may be omitted when inside a class. Explicitly passing &null; as the object is no longer allowed as of PHP 7.2.0. The parameter is still optional and calling get_class without a parameter from inside a class will work, but passing &null; now emits an E_WARNING notice. &reftitle.returnvalues; Returns the name of the class of which object is an instance. Returns &false; if object is not an object. If object is omitted when inside a class, the name of that class is returned. If the object is an instance of a class which exists in a namespace, the qualified namespaced name of that class is returned. &reftitle.errors; If get_class is called with anything other than an object, an E_WARNING level error is raised. &reftitle.changelog; &Version; &Description; 7.2.0 &null; was removed as the default value for object, and is no longer a valid input. 5.3.0 &null; became the default value for object, so passing &null; to object now has the same result as not passing any value. &reftitle.examples; Using <function>get_class</function> name(); ?> ]]> &example.outputs; Using <function>get_class</function> in superclass ]]> &example.outputs; Using <function>get_class</function> with namespaced classes ]]> &example.outputs; &reftitle.seealso; get_called_class get_parent_class gettype is_subclass_of