3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a=str_split(str_repeat("a",99999)); $pre_best = PHP_INT_MAX; $post_best = PHP_INT_MAX; for($i=0;$i<99;++$i){ $t=microtime(true); array_is_list_pre($a); $t=microtime(true)-$t; if($t < $pre_best){ $pre_best = $t; } } for($i=0;$i<99;++$i){ $t=microtime(true); array_is_list_post($a); $t=microtime(true)-$t; if($t < $post_best){ $post_best = $t; } } if($pre_best===$post_best){ echo "it's a tie!"; }elseif($pre_best<$post_best){ echo "pre won!"; }else{ echo "post won!"; } var_dump($pre_best,$post_best); function array_is_list_pre(array $array): bool { $i = 0; foreach ($array as $k => $v) { if ($k !== $i) { return false; } ++$i; } return true; } function array_is_list_post(array $array): bool { $i = 0; foreach ($array as $k => $v) { if ($k !== $i++) { return false; } } return true; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.1.20.0110.49923.50
8.1.10.0260.52123.45
8.1.00.0220.50123.36
8.0.150.0230.49122.69
8.0.140.0210.48722.56
8.0.130.0130.50222.66
8.0.120.0260.48222.61
8.0.110.0200.50222.58
8.0.100.0230.48222.53
8.0.90.0170.49822.64
8.0.80.0190.48522.70
8.0.70.0200.60222.60
8.0.60.0200.50222.55
8.0.50.0270.48722.60
8.0.30.0240.49722.68
8.0.20.0130.49222.56
8.0.10.0170.49622.83
7.4.270.0290.48622.20
7.4.260.0100.51022.24
7.4.250.0130.49822.25
7.4.240.0170.49722.33
7.4.230.0100.49622.19
7.4.220.0130.50022.33
7.4.210.0130.49222.16
7.4.200.0160.52322.29
7.4.190.0070.50522.39
7.4.180.0290.49122.30
7.4.160.0130.51422.44
7.4.150.0130.49222.25
7.4.140.0160.50522.30
7.4.130.0170.50122.18
7.4.120.0200.49422.25
7.4.110.0130.54422.07
7.4.100.0220.55622.34
7.4.90.0240.56122.27
7.4.80.0130.53622.12
7.4.70.0100.49422.23
7.4.60.0130.48822.13
7.4.50.0100.49122.16
7.4.40.0100.48622.01
7.4.30.0070.49322.23
7.4.20.0100.48822.25
7.4.10.0030.49622.13
7.4.00.0070.49022.22

preferences:
14.09 ms | 403 KiB | 5 Q