Re: late static binding php6
| From: | Lukas Kahwe Smith | Date: | Mon, 19 Nov 2007 12:27:50 +0000 |
| Subject: | Re: late static binding php6 | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-33304@lists.php.net to get a copy of this message | ||
On 18.11.2007, at 12:27, Gergely Hodicska wrote:
Hi! I read this thread, and I would like to ask if is there any decision about the behavior of inheritance? I wrote on my blog about late static binding (http://blog.felho.hu/what-is-new-in-php-53-part-2-late-static-binding.html), and I came up with the following example: <?php class ActiveRecord {I think the point of Stas reply was to use self:: instead of parent::. regards, Lukaspublic static function findByPk($id) { $calledClass = get_called_class(); // The magic remains... }} class Blog extends ActiveRecord {public static function findByPk($id) { // We want to log something.// Then the parent should do the magic. parent::findByPk($id); }} Blog::findByPk(1); ?>