<?php
class foo {
function foo()
{
// implements some logic
}
function name()
{
echo "My name is " , get_class($this) , "
";
}
}
// create an object
$bar = new foo();
// external call
echo "Its name is " , get_class($bar) , "
";
// internal call
$bar->name();
?>
返回对象实例 obj 所属类的名字。