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 = []; foreach ($rand as $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++) { $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.4.50.0280.20619.05
8.4.40.0140.18618.71
8.4.30.0110.18719.09
8.4.20.0200.18119.09
8.4.10.0170.19318.98
8.3.190.0260.20117.86
8.3.180.0260.18417.95
8.3.170.0280.17117.77
8.3.160.0290.18817.92
8.3.150.0320.18518.30
8.3.140.0330.17417.89
8.3.130.0210.17817.88
8.3.120.0290.16817.67
8.3.110.0280.18717.75
8.3.100.0400.18217.81
8.3.90.0280.18118.00
8.3.80.0380.22717.73
8.3.70.0220.18317.59
8.3.60.0190.20417.72
8.3.50.0360.19917.75
8.3.40.0240.17419.00
8.3.30.0170.18418.89
8.3.20.0210.18818.78
8.3.10.0190.17818.88
8.3.00.0310.20618.69
8.2.280.0350.17917.83
8.2.270.0230.18517.76
8.2.260.0250.16917.83
8.2.250.0270.19217.75
8.2.240.0290.19617.82
8.2.230.0200.18518.01
8.2.220.0210.17817.55
8.2.210.0340.19517.86
8.2.200.0370.16617.69
8.2.190.0190.16017.74
8.2.180.0190.16318.04
8.2.170.0460.16418.95
8.2.160.0190.15819.14
8.2.150.0180.16319.02
8.2.140.0330.18018.70
8.2.130.0550.16619.02
8.2.120.0230.15919.16
8.2.110.0210.15919.06
8.2.100.0210.15918.91
8.2.90.0230.19519.05
8.2.80.0360.17318.91
8.2.70.0460.18918.98
8.2.60.0490.17119.02
8.2.50.0200.16218.97
8.2.40.0340.16518.90
8.2.30.0350.17818.92
8.2.20.0350.17418.91
8.2.10.0420.17819.04
8.2.00.0320.16518.96
8.1.320.0250.17717.62
8.1.310.0270.16918.02
8.1.300.0160.17318.07
8.1.290.0300.19917.86
8.1.280.0190.18817.94
8.1.270.0290.20519.15
8.1.260.0210.19319.27
8.1.250.0270.18919.09
8.1.240.0200.19219.09
8.1.230.0350.19919.16
8.1.220.0290.20019.06
8.1.210.0190.19518.96
8.1.200.0230.19119.12
8.1.190.0360.18118.88
8.1.180.0410.18119.21
8.1.170.0170.18419.05
8.1.160.0400.18119.36
8.1.150.0260.16719.29
8.1.140.0410.18518.99
8.1.130.0240.17818.99
8.1.120.0300.19518.98
8.1.110.0170.17119.23
8.1.100.0290.18519.05
8.1.90.0190.17019.06
8.1.80.0190.16819.11
8.1.70.0170.18119.11
8.1.60.0200.16519.32
8.1.50.0360.18619.25
8.1.40.0190.17219.21
8.1.30.0230.18219.22
8.1.20.0210.16919.35
8.1.10.0280.34919.37
8.1.00.0340.36119.25
8.0.300.0200.17218.28
8.0.290.0170.17718.09
8.0.280.0260.16618.39
8.0.270.0300.16618.43
8.0.260.0170.17418.27
8.0.250.0430.17918.46
8.0.240.0230.17418.30
8.0.230.0370.18418.37
8.0.220.0410.18117.99
8.0.210.0210.17118.57
8.0.200.0230.17818.23
8.0.190.0210.16918.32
8.0.180.0410.18718.52
8.0.170.0220.17218.39
8.0.160.0360.19118.24
8.0.150.0330.18618.28
8.0.140.0250.35518.48
8.0.130.0340.34918.38
8.0.120.0280.36018.52
8.0.110.0350.36018.37
8.0.100.0410.35318.50
8.0.90.0330.35418.48
8.0.80.0360.35218.49
8.0.70.0330.35718.46
8.0.60.0410.34718.46
8.0.50.0320.35718.43
8.0.30.0380.35318.40
8.0.20.0290.36518.61
8.0.10.0310.35718.65
8.0.00.0310.35918.59
7.4.330.0160.17918.09
7.4.320.0370.18118.18
7.4.300.0220.18017.83
7.4.290.0350.18818.21
7.4.280.0170.18118.27
7.4.270.0350.37218.15
7.4.260.0320.35318.05
7.4.250.0290.35618.14
7.4.240.0340.34918.01
7.4.230.0330.35018.18
7.4.220.0310.35218.15
7.4.210.0330.34717.99
7.4.200.0410.34318.08
7.4.190.0330.35818.13
7.4.180.0320.35918.20
7.4.160.0300.34918.16
7.4.150.0320.35418.11
7.4.140.0280.34618.10
7.4.130.0330.35018.11
7.4.120.0410.35218.13
7.4.110.0310.34617.97
7.4.100.0400.34618.06
7.4.90.0350.35918.07
7.4.80.0390.35217.98
7.4.70.0370.34818.04
7.4.60.0320.34518.06
7.4.50.0330.35117.93
7.4.40.0360.35018.00
7.4.30.0270.35518.05
7.4.20.0290.35618.13
7.4.10.0250.35318.14
7.4.00.0340.35717.98
7.3.330.0290.35817.85
7.3.320.0270.35717.88
7.3.310.0290.36118.31
7.3.300.0330.36618.60
7.3.290.0260.35618.68
7.3.280.0340.35318.55
7.3.270.0270.34418.71
7.3.260.0320.35018.66
7.3.250.0320.36018.66
7.3.240.0320.35818.05
7.3.230.0320.35917.87
7.3.220.0260.36817.92
7.3.210.0290.36517.97
7.3.200.0280.35517.88
7.3.190.0300.35917.99
7.3.180.0340.36617.80
7.3.170.0260.36717.94
7.3.160.0350.35717.82
7.3.150.0340.35617.82
7.3.140.0400.37317.85
7.3.130.0340.36717.78

preferences:
34.69 ms | 403 KiB | 5 Q