Skip to content

Instantly share code, notes, and snippets.

@rafaelss
Created August 9, 2008 02:07
Show Gist options
  • Save rafaelss/4646 to your computer and use it in GitHub Desktop.
Save rafaelss/4646 to your computer and use it in GitHub Desktop.
<?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