Created
August 9, 2008 02:07
-
-
Save rafaelss/4646 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 ActiveRecord { | |
public static function find($id) { | |
echo $id, PHP_EOL; | |
} | |
} | |
class ActiveRecordCache { | |
public static function cache($finder) { | |
if($cached) { | |
return $cachedResults; | |
} | |
return $finder(); | |
} | |
} | |
ActiveRecordCache::cache(function() { | |
return ActiveRecord::find(1); | |
}); | |
$find = function($id) { | |
echo $id, PHP_EOL; | |
}; | |
$find(1); | |
$array = array(1, 2, 3, 4, 5); | |
array_map(function($text) { echo $text, PHP_EOL; }, $array); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment