values = $args; $this->func = $func; } function method($str) { $args = func_get_args(); return call_user_func_array($this->func, array_merge($args, $this->values)); } } } //assume $0 is funcname, $1-$x is partial values $args = func_get_args(); $func = $args[0]; $p = new partial($func, array_slice($args,1)); return array($p, 'method'); } $data = array("O'Reilly","Zend","Prentice Hall", "Wrox","IDG", "MacMillan"); $data = $data + $data + $data; define("ITERATIONS",10000); require_once 'Benchmark/Timer.php'; $timer = new Benchmark_Timer(TRUE); for($i=0;$i$v) { $data2[$k] = htmlentities($v, ENT_QUOTES); } } $timer->setMarker('Using foreach loop ENT_QUOTES: ' . memory_get_usage(true)); for($i=0;$i$v) { $data2[$k] = htmlentities($v); } } $timer->setMarker('foreach loop w/o ENT_QUOTES: ' . memory_get_usage(true)); for($i=0;$isetMarker('Using array_map: ' . memory_get_usage(true)); for($i=0;$isetMarker('Using array_map with partialed htmlentities: ' . memory_get_usage(true)); for($i=0;$isetMarker('Using array_map with create_function wrapped htmlentities: ' . memory_get_usage(true)); $timer->stop(); #$timer->display();