Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
// get all routing objects | |
$patterns = $app['routes']->getIterator(); // seems to be changed in Silex 1.1.0 !!! ... ->current()->all(); | |
// walk through the routing objects | |
foreach ($patterns as $pattern) { | |
$match = $pattern->getPattern(); | |
echo "$match<br />"; | |
} |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
function Memoize($function) { | |
$cache = array(); | |
return function() use (&$cache, $function) { | |
$args = func_get_args(); | |
$serialized = serialize($args); | |
if( isset($cache[$serialized]) ) | |
return $cache[$serialized]; |