Created
June 21, 2010 06:08
-
-
Save pifantastic/446480 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
| $result = function_that_does_crazy_stuff($arg1, $arg2); | |
| // becomes | |
| $result = memoize('function_that_does_crazy_stuff', $arg1, $arg2); | |
| $result = StaticClass::method($arg1, $arg2); | |
| // becomes | |
| $result = memoize(array('StaticClass', 'method'), $arg1, $arg2); | |
| $object = new SomeClass; | |
| $result = $object->method($arg1, $arg2); | |
| // becomes | |
| $result = memoize(array($object, 'method'), $arg1, $arg2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you might want to initialize your variables up at the top. Empty functions would probably be the logical choice. Maintaining type consistency is key. Certainly stay away from arrays.