note 85725 added to language.oop5.late-static-bindings
| From: | kx at osu1 dot php dot net | Date: | Sun, 14 Sep 2008 16:39:32 +0000 |
| Subject: | note 85725 added to language.oop5.late-static-bindings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-144412@lists.php.net to get a copy of this message | ||
At least as of PHP 5.3.0a2 there's a function get_called_class(), which returns the class on
which the static method is called.
<?php
class a {
static public function test() {
print get_called_class();
}
}
class b extends a {
}
a::test(); // "a"
b::test(); // "b"
?>
----
Server IP: 91.189.86.54
Probable Submitter: 90.151.144.32
----
Manual Page -- http://www.php.net/manual/en/language.oop5.late-static-bindings.php
Edit -- https://master.php.net/note/edit/85725
Del: integrated -- https://master.php.net/note/delete/85725/integrated
Del: useless -- https://master.php.net/note/delete/85725/useless
Del: bad code -- https://master.php.net/note/delete/85725/bad+code
Del: spam -- https://master.php.net/note/delete/85725/spam
Del: non-english -- https://master.php.net/note/delete/85725/non-english
Del: in docs -- https://master.php.net/note/delete/85725/in+docs
Del: other reasons-- https://master.php.net/note/delete/85725
Reject -- https://master.php.net/note/reject/85725
Search -- https://master.php.net/manage/user-notes.php