Created
March 1, 2012 16:47
-
-
Save auroraeosrose/1951282 to your computer and use it in GitHub Desktop.
Why PHP doesn't allow $class->property()
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 Test { | |
public function foo() { | |
echo 'I am happy and called'; | |
} | |
} | |
$test = new Test(); | |
$test->foo = function() { echo 'dynamic'; }; | |
$test->foo(); // WTF do I call? the closure named foo? or the function named foo? how would you write those rules? Who wouldn't be angry with whatever was suggested? and what about the slowdown from the double hashtable lookup? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment