Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Why PHP doesn't allow $class->property()
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