Monday, July 27, 2009

more php5 musing

Whilst in normal php-land another livable library for me is going to be my phparrayplus leveraging anon functions.


$results = StaticClass::methodReturnsArray($arg)->eachPair(function($i, $x){
return $x->lookMaNoTmpVars($i + 1);
});


In my opinion so much prettier than

$results = StaticClass::methodReturnsArray($arg);
foreach($results as $i=>$x){
$results[$i] = $x->lookMoCrappTastic($i + 1);
}

No comments: