Skip to content

Instantly share code, notes, and snippets.

@auroraeosrose
Created March 1, 2012 16:47
Show Gist options
  • Save auroraeosrose/1951282 to your computer and use it in GitHub Desktop.
Save auroraeosrose/1951282 to your computer and use it in GitHub Desktop.
Why PHP doesn't allow $class->property()
<?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