3v4l.org

run code in 300+ PHP versions simultaneously
#!/usr/bin/php <?php declare(strict_types=1); const ITERATIONS = 100000; $results = array(); for ($i = 0; $i < ITERATIONS; ++$i) { // heat up cpu (if it was powersaving-running-low-cus-nothing-was-happening, most modern cpus try to do it by default) } function array_is_list_post(array $array): bool { $i = 0; foreach ($array as $k => $v) { if ($k !== $i++) { return false; } } return true; } function array_is_list_pre(array $array): bool { $i = -1; foreach ($array as $k => $v) { ++$i; if ($k !== $i) { return false; } } return true; } $l1 = str_split(str_repeat("A", 300), 1); $t = microtime(true); for ($i = 0; $i < ITERATIONS; ++$i) { array_is_list_pre($l1); } $t = microtime(true) - $t; $results["pre"] = $t; $t = microtime(true); for ($i = 0; $i < ITERATIONS; ++$i) { array_is_list_post($l1); } $t = microtime(true) - $t; $results["post"] = $t; if ($results["pre"] === $results["post"]) { echo "it's a tie!"; } elseif ($results["pre"] < $results["post"]) { echo "pre is faster!"; } else { echo "post is faster!"; } echo "diff: " . abs(($results["pre"] - $results["post"])) . "\n"; var_dump($results); exit();

Abusive script

This script was stopped while abusing our resources

Output for git.master
pre is faster!diff: 0.0097970962524414 array(2) { ["pre"]=> float(0.3952620029449463) ["post"]=> float(0.4050590991973877) }
Output for git.master_jit
pre is faster!diff: 0.0040760040283203 array(2) { ["pre"]=> float(0.42237210273742676) ["post"]=> float(0.42644810676574707) }
Output for rfc.property-hooks
pre is faster!diff: 0.028541088104248 array(2) { ["pre"]=> float(0.4747810363769531) ["post"]=> float(0.5033221244812012) }

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:
27.44 ms | 408 KiB | 5 Q