note 88856 added to function.get-class
| From: | Lanselot at osu1 dot php dot net | Date: | Wed, 11 Feb 2009 10:09:57 +0000 |
| Subject: | note 88856 added to function.get-class | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-150472@lists.php.net to get a copy of this message | ||
Beware if you're omitting the parameter on inherited classes.
It'll return the class name of the method where it's called.
<?php
class A {
function foo() {
return get_class();
}
}
class B extends A {
function bar() {
return get_class();
}
}
$instance = new B();
echo $instance->bar(); //Prints 'B';
echo $instance->foo(); //Prints 'A';
?>
----
Server IP: 80.64.47.13
Probable Submitter: 87.219.165.186
----
Manual Page -- http://www.php.net/manual/en/function.get-class.php
Edit -- https://master.php.net/note/edit/88856
Del: integrated -- https://master.php.net/note/delete/88856/integrated
Del: useless -- https://master.php.net/note/delete/88856/useless
Del: bad code -- https://master.php.net/note/delete/88856/bad+code
Del: spam -- https://master.php.net/note/delete/88856/spam
Del: non-english -- https://master.php.net/note/delete/88856/non-english
Del: in docs -- https://master.php.net/note/delete/88856/in+docs
Del: other reasons-- https://master.php.net/note/delete/88856
Reject -- https://master.php.net/note/reject/88856
Search -- https://master.php.net/manage/user-notes.php