3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Initializing $arr = []; // Mocking for ($i = 0; $i < 400; $i++){ for ($j = 0; $j < 400; $j++){ $arr[$i][] = $j; } } // -------------------------------------------------------- // Start time tracking $time_start = microtime(true); for ($i = 0; $i < 400; $i++){ for ($j = 0; $j < 400; $j++){ if ($arr[$i][$j] > 0){ /* Do stuff */ } } } // Finish time tracking $time_end = microtime(true); // Execution time of the script $execution_time = ($time_end - $time_start)/60; echo 'Total Execution Time #1: '.$execution_time.' Secs' . PHP_EOL; // -------------------------------------------------------- // Start time tracking $time_start = microtime(true); for ($i = 0; $i < 400; $i++){ for ($j = 0; $j < 400; $j++){ if ($arr[$j][$i] > 0){ /* Do stuff */ } } } // Finish time tracking $time_end = microtime(true); // Execution time of the script $execution_time = ($time_end - $time_start)/60; echo 'Total Execution Time #2: '.$execution_time.' Secs';

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.10.0060.01623.61
8.1.00.0060.01623.41
8.0.140.0070.01722.76
8.0.130.0000.02222.75
8.0.120.0090.01322.83
8.0.110.0060.01622.86
8.0.100.0000.02222.67
8.0.90.0060.01622.90
8.0.80.0060.01622.74
8.0.70.0160.00622.81
8.0.60.0090.01222.86
8.0.50.0000.02222.63
8.0.30.0040.01822.61
8.0.20.0040.01922.85
8.0.10.0060.01622.87
7.4.270.0060.01622.48
7.4.260.0040.01922.33
7.4.250.0060.01622.48
7.4.240.0070.01722.37
7.4.230.0070.01722.39
7.4.220.0070.01722.33
7.4.210.0040.01822.48
7.4.200.0100.01322.38
7.4.190.0000.02422.50
7.4.180.0090.01522.43
7.4.160.0000.02322.44
7.4.150.0070.01622.47
7.4.140.0030.02122.31
7.4.130.0030.02022.40
7.4.120.0110.01122.36
7.4.110.0060.01622.45
7.4.100.0070.01722.57
7.4.90.0100.01322.25
7.4.80.0030.02022.45
7.4.70.0030.01922.35
7.4.60.0060.01622.38
7.4.50.0100.01322.25
7.4.40.0070.01622.40
7.4.30.0070.01722.37
7.4.20.0070.01622.43
7.4.10.0040.01922.41
7.4.00.0030.02122.50

preferences:
43.05 ms | 669 KiB | 5 Q