3v4l.org

run code in 300+ PHP versions simultaneously
<?php function returnTime(callable $function, int $repeat = 50) { $tests = []; for ($i = 0; $i < $repeat; ++$i) { $startTime = microtime(true); $function(); $endTime = microtime(true); $tests[] = $endTime - $startTime; } // Representing the average return 1000 * array_sum($tests) / $repeat; } $array = range(0, 450000); unset($array[0]); echo "Duration of array_values: ", returnTime(function() use ($array) { $newArray = array_values($array); }); echo PHP_EOL; echo "Duration of splat-pack: " , returnTime(function() use ($array){ $newArray = [...$array]; });

Abusive script

This script was stopped while abusing our resources

Output for git.master
Duration of array_values: 3.6937761306763 Duration of splat-pack: 3.2344770431519
Output for git.master_jit
Duration of array_values: 3.8065671920776 Duration of splat-pack: 3.4878301620483
Output for rfc.property-hooks
Duration of array_values: 3.1260633468628 Duration of splat-pack: 2.6188898086548

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
26.04 ms | 408 KiB | 5 Q