3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rand = []; $max = 10000; for ($i = 0; $i < $max; $i++) { $rand[bin2hex(random_bytes(10))] = $i; } $max = 1000; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $keys = []; $arr2 = []; foreach ($rand as $k => $v) { $arr2[$k] = $v; $keys[] = $k; } } printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max); $max = 1000; $start = microtime(true); for ($i = 0; $i < $max; $i++) { $arr2 = []; foreach ($rand as $k => $v) { $arr2[$k] = $v; } $keys = array_keys($rand); } printf("Took %.7f seconds per execution\n", (microtime(true) - $start) / $max);

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.0331.57721.17
8.1.00.0451.52721.10
8.0.140.0291.65120.32
8.0.130.0451.63420.16
8.0.120.0371.61520.23
8.0.110.0331.61120.30
8.0.100.0461.65520.15
8.0.90.0391.63820.34
8.0.80.0301.44420.19
8.0.70.0461.71220.13
8.0.60.0441.50020.34
8.0.50.0361.65620.31
8.0.30.0431.60520.22
8.0.20.0401.59820.38
8.0.10.0331.51020.43
8.0.00.0231.37020.40
7.4.270.0201.36519.98
7.4.260.0291.35219.91
7.4.250.0431.35119.96
7.4.240.0301.35319.81
7.4.230.0361.34619.98
7.4.220.0321.36019.97
7.4.210.0301.35119.89
7.4.200.0371.34319.88
7.4.190.0371.35719.86
7.4.180.0271.35819.97
7.4.160.0361.34719.95
7.4.150.0401.34519.96
7.4.140.0301.35819.89
7.4.130.0271.35519.88
7.4.120.0431.33119.75
7.4.110.0201.36019.94
7.4.100.0331.36420.00
7.4.90.0271.33919.76
7.4.80.0231.36619.82
7.4.70.0291.38319.94
7.4.60.0271.36519.90
7.4.50.0271.43019.83
7.4.40.0331.36219.89
7.4.30.0371.34919.86
7.4.20.0231.36219.83
7.4.10.0401.34719.83
7.4.00.0331.34819.96
7.3.330.0331.33919.88
7.3.320.0411.34719.76
7.3.310.0331.34619.77
7.3.300.0231.35019.53
7.3.290.0291.35919.68
7.3.280.0261.37119.71
7.3.270.0411.33419.76
7.3.260.0271.36119.69
7.3.250.0331.34719.68
7.3.240.0331.35319.54
7.3.230.0351.34319.60
7.3.220.0331.36119.68
7.3.210.0331.36719.52
7.3.200.0331.35119.61
7.3.190.0201.35819.77
7.3.180.0391.34219.56
7.3.170.0431.32919.66
7.3.160.0401.34019.72
7.3.150.0271.36119.71
7.3.140.0431.33319.68
7.3.130.0401.34619.71

preferences:
48.14 ms | 403 KiB | 5 Q