<?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) , "\n";
// internal call
$bar->name();
?>
返回对象实例 obj 所属类的名字。