note 83917 added to language.oop5.late-static-bindings
| From: | martinpauly | Date: | Wed, 18 Jun 2008 12:54:09 +0000 |
| Subject: | note 83917 added to language.oop5.late-static-bindings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-140564@lists.php.net to get a copy of this message | ||
will this work for variables as well?
it would be great, if the following worked:
<?php
class A {
protected static $table = "table";
public static function connect(){
//do some stuff here
echo static::$table;
return static::getInstance(); //function getInstance() now can return classes A or B depending
on the context it was called
}
...
}
class B extends A {
protected static $table = "subtable";
...
}
$table = B::connect(); //hopefully the output will be: subtable
?>
----
Server IP: 69.147.83.197
Probable Submitter: 79.233.68.109
----
Manual Page -- http://www.php.net/manual/en/language.oop5.late-static-bindings.php
Edit -- https://master.php.net/note/edit/83917
Del: integrated -- https://master.php.net/note/delete/83917/integrated
Del: useless -- https://master.php.net/note/delete/83917/useless
Del: bad code -- https://master.php.net/note/delete/83917/bad+code
Del: spam -- https://master.php.net/note/delete/83917/spam
Del: non-english -- https://master.php.net/note/delete/83917/non-english
Del: in docs -- https://master.php.net/note/delete/83917/in+docs
Del: other reasons-- https://master.php.net/note/delete/83917
Reject -- https://master.php.net/note/reject/83917
Search -- https://master.php.net/manage/user-notes.php