rfc:pass_scope_to_magic_accessors

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Last revisionBoth sides next revision
rfc:pass_scope_to_magic_accessors [2023/01/19 17:13] nicolasgrekasrfc:pass_scope_to_magic_accessors [2023/01/19 17:39] nicolasgrekas
Line 21: Line 21:
 <PHP> <PHP>
 class Foo { class Foo {
 +    private $abc;
 +    
 +    public function __construct()
 +    {
 +        unset($this->abc); // enables magic methods when accessing the property
 +    }
 +    
     public function __get($name) {     public function __get($name) {
         var_dump(debug_backtrace()[1]['class'] ?? null);         var_dump(debug_backtrace()[1]['class'] ?? null);
rfc/pass_scope_to_magic_accessors.txt · Last modified: 2023/05/09 16:25 by nicolasgrekas