Skip to content

Instantly share code, notes, and snippets.

@hertsch
hertsch / kitframework_list_routing_patterns.php
Last active April 26, 2017 08:28
Silex: get a list of all routing URI patterns
// 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 />";
}
@ziadoz
ziadoz / awesome-php.md
Last active April 17, 2024 21:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@stuartloxton
stuartloxton / gist:652483
Created October 28, 2010 22:35
Closure Memoization in PHP
<?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];