php print inherited class name

by Prakash 2014-09-04 17:58:07

Is it possible in php to print inherited class name using a function in parent class ?

No it is not possible.


class Base {
public static function whoAmI() {
return get_called_class();
}
}

class User extends Base {}

print Base::whoAmI(); // prints "Base"
print User::whoAmI(); // prints "User"

Tagged in:

1385
like
0
dislike
0
mail
flag

You must LOGIN to add comments