3v4l.org

run code in 300+ PHP versions simultaneously
<?php function debug($arr){ echo '<pre>' ; print_r($arr); echo '</pre>'; } for($i=0; $i<5; $i++) { $arr[$i] = rand(0,10); } // $arr = Array // ( // 0 => 7, // 1 => 2, // 2 => 9, // 3 => 9, // 4 => 0, // ); // print_r($arr) . PHP_EOL; debug($arr) . PHP_EOL; $size_arr = sizeof($arr); // debug($size_arr) . PHP_EOL; $diff = array_sum($arr); for ($i=0; $i < $size_arr; $i++) { $a = $arr[$i]; //echo 'echo $i - ' . $i . PHP_EOL; //$index = [$diff => [$i,$j]]; for( $j=$i+1; $j < $size_arr; $j++) { $b = $arr[$j]; $newdiff = abs($a-$b); // echo $a . ' - ' . $b . ' = ' . $newdiff . '<br>'; //echo '------- $diff ----- ' . $diff . PHP_EOL; //echo '------- $newdiff --- ' . $newdiff . PHP_EOL; if ($newdiff < $diff) { $index = [$newdiff => [$i,$j]]; $diff = $newdiff; } elseif ($newdiff == $diff) { $newvalues = [$newdiff => [$i, $j]]; array_push($index, $newvalues); } } } debug($index);

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.90.0040.00417.41
8.1.80.0160.00017.32
8.1.70.0080.00817.43
8.1.60.0070.01117.48
8.1.50.0090.00917.38
8.1.40.0150.00417.56
8.1.30.0180.00017.67
8.1.20.0110.00717.63
8.1.10.0090.00817.45
8.1.00.0110.00717.52
8.0.220.0070.00516.86
8.0.210.0090.00616.89
8.0.200.0120.00416.84
8.0.190.0100.00516.81
8.0.180.0150.00016.80
8.0.170.0070.00716.87
8.0.160.0110.00316.82
8.0.150.0070.00716.73
8.0.140.0040.01116.87
8.0.130.0070.00916.81
8.0.120.0070.00916.80
8.0.110.0050.00916.71
8.0.100.0070.00716.75
8.0.90.0100.00516.71
8.0.80.0080.00816.72
8.0.70.0140.00016.69
8.0.60.0100.00516.82
8.0.50.0120.00416.93
8.0.30.0080.00816.73
8.0.20.0120.00216.88
8.0.10.0150.00016.88
7.4.300.0090.00616.53
7.4.290.0120.00416.36
7.4.280.0130.00016.50
7.4.270.0070.00716.40
7.4.260.0100.00316.44
7.4.250.0160.00016.38
7.4.240.0120.00016.59
7.4.230.0100.00516.51
7.4.220.0100.00516.43
7.4.210.0040.01116.38
7.4.200.0100.00316.49
7.4.190.0150.00016.44
7.4.180.0080.00816.70
7.4.160.0050.00916.50
7.4.150.0040.00816.34
7.4.140.0120.00016.43
7.4.130.0110.00416.36
7.4.120.0150.00016.41
7.4.110.0070.00716.30
7.4.100.0070.00716.61
7.4.90.0150.00016.36
7.4.80.0110.00416.54
7.4.70.0120.00316.43
7.4.60.0080.00716.36
7.4.50.0110.00316.32
7.4.40.0150.00016.46
7.4.30.0080.00316.52
7.4.20.0140.00016.44
7.4.10.0140.00016.49
7.4.00.0150.00016.45

preferences:
13.69 ms | 406 KiB | 5 Q