On 4/30/2016 5:51 PM, Fleshgrinder wrote: > $ret = scandir($arg) > |> array_filter($$, function($x) { return $x !== '.' && $x != '..'; }) > |> array_map(function ($x) use ($arg) { return $arg . '/' . $x; }, $$) > |> getFileArg($$) > |> array_merge($ret, $$);
This should actually be formatted as to be fair contender to the procedural example: $ret = scandir($arg) |> array_filter($$, function ($x) { return $x !== '.' && $x !== '..'; }) }> array_map(function ($x) use ($arg) { return $arg . '/' . $x; }, $$) |> getFileArg($$) |> array_merge($ret, $$); Not a big difference now... $files = scandir($arg); $files = array_filter($files, function ($x) { return $x !== '.' && $x !== '..'; }); $files = array_map(function ($x) use ($arg) { return $path . '/' . $x; }, $files); $ret = array_merge($ret, getFileArg($files)); ...the only thing that bugs me in the procedural code is the fact that array_filter and array_map take their arguments in different order. :P -- Richard "Fleshgrinder" Fussenegger
signature.asc
Description: OpenPGP digital signature