Created
December 11, 2013 19:59
-
-
Save DNA/7917360 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class myStdClass { | |
public function __call($method, $args) { | |
if (isset($this->$method)) { | |
return call_user_func_array($this->$method, $args); | |
} | |
} | |
} | |
$x = new myStdClass; | |
$x->a = function () { | |
$D = new myStdClass; | |
$D->c = 5; | |
$D->b = function () use ($D) { | |
return $D->c; | |
}; | |
return $D; | |
}; | |
echo $x->a()->b(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment