3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $array = range(0, 1000, 1); $benchmarks = []; $runs = 100; $callback = function ($item) { return $item * 2; }; $benchmarks['map_closure'] = function ($array) use ($callback) { return array_map($callback, $array); }; foreach ($benchmarks as $code => $callable) { $start = microtime(true); $collected = 0; while ($collected < $runs) { $collected++; $callable($array); } $end = microtime(true); printf('%s runs in %ss %s', $code, $end - $start, PHP_EOL); }
based on ohVb1