3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [['user1' => 20], ['user2' => 30], 3 => ['user3' => 10]]; echo array_reduce( $array, fn($result, $row) => $result + current($row), 0 ); echo "\n---\n"; array_walk_recursive($array, function($v)use(&$sum){ $sum += $v; }); // visit each leafnode, increase the $sum tally echo $sum; echo "\n---\n"; $total = 0; // without this declaration, you will generate: "Notice: Undefined variable" foreach ($array as $subarray) { foreach ($subarray as $v) { $total += $v; } } echo $total;

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.5.00.0110.01120.09
8.4.150.0030.00014.05
8.4.140.0140.00817.49
8.4.130.0100.00918.00
8.4.120.0130.00820.58
8.4.110.0120.00818.57
8.4.100.0150.00617.67
8.4.90.0120.00817.66
8.4.80.0050.00317.65
8.4.70.0130.00317.50
8.4.60.0060.01019.42
8.4.50.0100.00917.65
8.4.40.0140.00619.38
8.4.30.0150.00318.68
8.4.20.0060.01319.49
8.4.10.0080.00822.04
8.3.280.0090.01218.29
8.3.270.0110.00816.51
8.3.260.0090.00716.69
8.3.250.0110.00719.10
8.3.240.0130.00716.80
8.3.230.0090.01016.60
8.3.220.0140.00417.35
8.3.210.0050.00216.44
8.3.200.0100.00916.54
8.3.190.0070.00316.48
8.3.180.0060.00516.70
8.3.170.0070.00718.87
8.3.160.0100.00717.18
8.3.150.0070.01117.37
8.3.140.0000.00816.29
8.3.130.0120.00616.54
8.3.120.0070.01120.63
8.3.110.0130.00716.86
8.3.100.0100.01016.79
8.3.90.0150.00326.77
8.3.80.0030.00616.75
8.3.70.0140.00316.75
8.3.60.0100.01016.63
8.3.50.0090.00618.21
8.3.40.0130.00620.25
8.3.30.0160.00318.54
8.3.20.0040.00424.18
8.3.10.0060.00324.66
8.3.00.0040.00426.16
8.2.290.0140.00418.97
8.2.280.0080.01116.39
8.2.270.0120.00618.63
8.2.260.0130.00716.41
8.2.250.0030.00616.71
8.2.240.0030.00516.38
8.2.230.0100.01020.94
8.2.220.0060.00324.06
8.2.210.0080.00026.77
8.2.200.0060.00318.16
8.2.190.0110.00416.58
8.2.180.0040.01225.92
8.2.170.0100.01022.96
8.2.160.0070.00722.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0080.00026.16
8.2.110.0100.01019.30
8.2.100.0120.00017.78
8.2.90.0000.00817.74
8.2.80.0030.00618.61
8.2.70.0040.00417.75
8.2.60.0030.00617.63
8.2.50.0060.00317.75
8.2.40.0000.00918.22
8.2.30.0020.00518.01
8.2.20.0000.00719.38
8.2.10.0030.00618.16
8.2.00.0000.00719.25
8.1.330.0060.00516.29
8.1.320.0100.00916.22
8.1.310.0110.00416.47
8.1.300.0040.00415.94
8.1.290.0080.00430.84
8.1.280.0040.01125.92
8.1.270.0080.00024.66
8.1.260.0000.00726.35
8.1.250.0000.00828.09
8.1.240.0060.00319.44
8.1.230.0040.00720.85
8.1.220.0060.00318.54
8.1.210.0080.00018.77
8.1.200.0030.00617.66
8.1.190.0060.00317.35
8.1.180.0000.00818.10
8.1.170.0040.00417.62
8.1.160.0030.00518.99
8.1.150.0030.00518.64
8.1.140.0070.00017.39
8.1.130.0050.00319.01
8.1.120.0070.00017.50
8.1.110.0040.00417.45
8.1.100.0140.00317.48
8.1.90.0110.00617.47
8.1.80.0080.00817.45
8.1.70.0100.00717.41
8.1.60.0110.00817.46
8.1.50.0150.00317.52
8.1.40.0150.00317.51
8.1.30.0110.00817.54
8.1.20.0170.00217.54
8.1.10.0110.00817.52
8.1.00.0040.01517.45
8.0.300.0070.00018.77
8.0.290.0060.00316.63
8.0.280.0070.00018.45
8.0.270.0000.00716.80
8.0.260.0040.00418.50
8.0.250.0070.00016.86
8.0.240.0000.00716.99
8.0.230.0060.00916.84
8.0.220.0150.00016.76
8.0.210.0100.00516.87
8.0.200.0060.01016.89
8.0.190.0080.00816.89
8.0.180.0130.00316.84
8.0.170.0120.00416.87
8.0.160.0160.00016.80
8.0.150.0100.00516.82
8.0.140.0080.00816.83
8.0.130.0040.00916.81
8.0.120.0120.00316.82
8.0.110.0080.00816.70
8.0.100.0050.01016.82
8.0.90.0170.00016.82
8.0.80.0030.01516.74
8.0.70.0110.00416.79
8.0.60.0120.00316.71
8.0.50.0150.00016.88
8.0.30.0030.01116.80
8.0.20.0100.00516.97
8.0.10.0100.00317.00
7.4.330.0030.00315.55
7.4.320.0000.00616.50
7.4.300.0100.00016.47
7.4.290.0080.00416.45
7.4.280.0150.00016.48
7.4.270.0130.00316.39
7.4.260.0180.00016.38
7.4.250.0060.01016.59
7.4.240.0120.00516.38
7.4.230.0130.00316.52
7.4.220.0110.00416.38
7.4.210.0130.00016.43
7.4.200.0070.00716.39
7.4.190.0050.01016.50
7.4.180.0160.00016.52
7.4.160.0110.00316.52
7.4.150.0140.00016.54
7.4.140.0100.00616.43
7.4.130.0070.00716.42
7.4.120.0090.00316.41
7.4.110.0060.00616.35
7.4.100.0110.00416.42
7.4.90.0090.00616.51
7.4.80.0090.00316.41
7.4.70.0100.00316.50
7.4.60.0110.00416.47
7.4.50.0100.00216.34
7.4.40.0080.00616.33
7.4.30.0130.00016.30
7.4.20.0070.00716.40
7.4.10.0160.00016.52
7.4.00.0040.00916.51

preferences:
42.2 ms | 403 KiB | 5 Q