3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Any; $value = array( ); for ($i=0;$i<1e6;$i++) { $value[] = $i; } $start = microtime(true); $values = array_map(function($item){ return $item+1;}, $value); $end = microtime(true); echo "Simple func took: ", number_format(($end-$start)*1e3, 2), PHP_EOL; $start = microtime(true); $values = \array_map(function($item){ return $item+1;}, $value); $end = microtime(true); echo "Direct func took: ", number_format(($end-$start)*1e3, 2);
based on JWXnC
Output for 7.0.0 - 7.3.0rc3
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33554440 bytes) in /in/fm4IU on line 13
Process exited with code 255.
Output for hhvm-3.15.4

Process exited with code 139.
Output for 5.6.0 - 5.6.30
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 32 bytes) in /in/fm4IU on line 8
Process exited with code 255.