Copyright © tutorialspoint.com
| get_class ( $object ); |
This function gets the name of the class of the given object.
| Parameter | Description |
|---|---|
| object | Required. The tested object. |
Returns the name of the class of which object is an instance. Returns FALSE if object is not an object.
Following is the usage of this function:
<?php
class foo {
function foo()
{
// implements some logic
}
function name()
{
echo "My name is " , get_class($this) , "\n";
}
}
// create an object
$bar = new foo();
// external call
echo "Its name is " , get_class($bar) , "<br>";
// internal call
$bar->name();
?>
|
It will produce following result:
Its name is foo My name is foo |
Copyright © tutorialspoint.com