note 126862 added to language.oop5.late-static-bindings
| From: | Anonymous at main dot php dot net | Date: | Sat, 19 Feb 2022 09:02:05 +0000 |
| Subject: | note 126862 added to language.oop5.late-static-bindings | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217629@lists.php.net to get a copy of this message | ||
class P_Class {
public static $val = "Parent";
public static function setVal($val){
static::$val = $val;
}
public static function getVal(){
return static::$val;
}
}
class C_Class extends P_Class{}
C_Class::setVal("Child");
var_dump(C_Class::getVal());
var_dump(P_Class::getVal());
Output:
string(5) "Child"
string(5) "Child"
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.135 (proxied: 128.71.147.120)
----
Manual Page -- https://php.net/manual/en/language.oop5.late-static-bindings.php
Edit -- https://main.php.net/note/edit/126862
Del: integrated -- https://main.php.net/note/delete/126862/integrated
Del: useless -- https://main.php.net/note/delete/126862/useless
Del: bad code -- https://main.php.net/note/delete/126862/bad+code
Del: spam -- https://main.php.net/note/delete/126862/spam
Del: non-english -- https://main.php.net/note/delete/126862/non-english
Del: in docs -- https://main.php.net/note/delete/126862/in+docs
Del: other reasons-- https://main.php.net/note/delete/126862
Reject -- https://main.php.net/note/reject/126862
Search -- https://main.php.net/manage/user-notes.php