3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rates = array( 'apple' => array( 'red' => array( 'rate' => 1.19, 'resume' => 'This is a red apple.' ), 'green' => array( 'rate' => 0.99, 'resume' => 'This is a green apple.' ), 'yellow' => array( 'rate' => 0.89, 'resume' => 'This is a yellow apple.' ), ) ); $cart = array( 'apple' => array( '0' => red, '1' => green ) ); $total = 0; foreach ($cart as $key => $arr) { if (isset($rates[$key])) { foreach ($arr as $value) { $total += $rates[$key]['rate'][$value] ?? 0; } } } 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.4.130.0120.00917.99
8.4.120.0110.00922.25
8.4.110.0070.00219.05
8.4.100.0130.00817.89
8.4.90.0100.00920.58
8.4.80.0110.00920.30
8.4.70.0080.00318.24
8.4.60.0080.01219.02
8.4.50.0140.00618.21
8.4.40.0170.00317.79
8.4.30.0060.00318.64
8.4.20.0070.01320.00
8.4.10.0000.00819.48
8.3.260.0110.00816.82
8.3.250.0070.01218.85
8.3.240.0120.00716.59
8.3.230.0110.00816.65
8.3.220.0110.00818.84
8.3.210.0120.00316.68
8.3.200.0040.00516.74
8.3.190.0120.00617.14
8.3.180.0100.00816.52
8.3.170.0100.01016.68
8.3.160.0100.01019.05
8.3.150.0160.00316.97
8.3.140.0060.00319.04
8.3.130.0070.00318.44
8.3.120.0000.00918.77
8.3.110.0070.00316.66
8.3.100.0000.00916.61
8.3.90.0120.00626.77
8.3.80.0090.00016.75
8.3.70.0070.01116.88
8.3.60.0180.00318.55
8.3.50.0130.00424.49
8.3.40.0120.00318.63
8.3.30.0040.01218.59
8.3.20.0060.00324.18
8.3.10.0070.00024.66
8.3.00.0080.00026.16
8.2.290.0120.00716.73
8.2.280.0090.00918.57
8.2.270.0110.00716.91
8.2.260.0040.00418.97
8.2.250.0110.00416.69
8.2.240.0060.00318.88
8.2.230.0060.00320.94
8.2.220.0030.00524.06
8.2.210.0040.01126.77
8.2.200.0040.00816.63
8.2.190.0090.00616.75
8.2.180.0140.01125.92
8.2.170.0120.00319.07
8.2.160.0110.00322.96
8.2.150.0050.00325.66
8.2.140.0000.00724.66
8.2.130.0000.00726.16
8.2.120.0040.00426.35
8.2.110.0060.00319.30
8.2.100.0100.00017.84
8.2.90.0040.00418.28
8.2.80.0060.00317.97
8.2.70.0040.00417.50
8.2.60.0040.00417.75
8.2.50.0040.00418.04
8.2.40.0030.00618.05
8.2.30.0000.00717.99
8.2.20.0040.00418.12
8.2.10.0000.00819.42
8.2.00.0000.00819.18
8.1.330.0110.00816.40
8.1.320.0130.00616.10
8.1.310.0060.00316.87
8.1.300.0130.00620.40
8.1.290.0060.00330.84
8.1.280.0040.01125.92
8.1.270.0060.00324.66
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00322.52
8.1.230.0070.00320.85
8.1.220.0050.00317.74
8.1.210.0040.00418.80
8.1.200.0030.00617.36
8.1.190.0050.00317.35
8.1.180.0000.00918.10
8.1.170.0080.00017.62
8.1.160.0000.00818.89
8.1.150.0040.00418.95
8.1.140.0040.00418.89
8.1.130.0030.00320.13
8.1.120.0030.00317.50
8.1.110.0040.00417.49
8.1.100.0040.00417.41
8.1.90.0000.00717.50
8.1.80.0040.00417.45
8.1.70.0080.00017.51
8.1.60.0030.00617.62
8.1.50.0040.00417.46
8.1.40.0080.00017.50
8.1.30.0040.00417.67
8.1.20.0000.00817.63
8.1.10.0050.00317.48
8.1.00.0000.00917.39
8.0.300.0050.00220.08
8.0.290.0000.00916.88
8.0.280.0030.00318.53
8.0.270.0030.00317.98
8.0.260.0000.00618.45
8.0.250.0030.00316.91
8.0.240.0000.00716.98
8.0.230.0000.00617.05
8.0.220.0000.00716.85
8.0.210.0070.00016.86
8.0.200.0030.00317.05
8.0.190.0070.00016.97
8.0.180.0000.00817.04
8.0.170.0080.00316.94
8.0.160.0040.00417.07
8.0.150.0030.00616.87
8.0.140.0100.00016.91
8.0.130.0000.00513.41
8.0.120.0030.00516.90
8.0.110.0040.00416.90
8.0.100.0050.00316.89
8.0.90.0050.00316.84
8.0.80.0050.01016.91
8.0.70.0040.00416.89
8.0.60.0040.00416.95
8.0.50.0000.00816.94
8.0.30.0090.00916.87
8.0.20.0090.01217.00
8.0.10.0000.00716.86
8.0.00.0150.00617.10
7.4.330.0050.00015.55
7.4.320.0070.00016.66
7.4.300.0000.00716.59
7.4.290.0030.00316.60
7.4.280.0000.00816.45
7.4.270.0070.00016.48
7.4.260.0000.00513.22
7.4.250.0000.00716.55
7.4.240.0030.00316.62
7.4.230.0000.00716.39
7.4.220.0040.00316.46
7.4.210.0090.00516.50
7.4.200.0080.00016.58
7.4.130.0080.00816.59
7.4.120.0150.00316.55
7.4.110.0090.00916.53
7.4.100.0070.01016.70
7.4.90.0140.00316.55
7.4.80.0110.00919.39
7.4.70.0120.00416.55
7.4.60.0130.01016.19
7.4.50.0100.01116.06
7.4.40.0070.01116.54
7.4.30.0090.01516.34
7.4.20.0290.00416.28
7.4.10.0210.00616.20
7.4.00.0080.00816.44
7.3.330.0030.00616.40
7.3.320.0000.00613.18
7.3.310.0000.00716.42
7.3.300.0040.00416.40
7.3.290.0050.01216.40
7.3.260.0100.01216.53
7.3.240.0110.01016.44
7.3.230.0110.00716.52
7.3.210.0090.00916.47
7.3.200.0060.01216.48
7.3.190.0140.01016.32
7.3.180.0070.01316.29
7.3.170.0120.00816.29
7.3.160.0110.01116.38
7.3.150.0180.01316.19
7.3.140.0140.00916.11
7.3.130.0250.00316.19
7.3.120.0050.01516.15
7.3.110.0160.00516.16
7.3.100.0110.01116.35
7.3.90.0130.01116.08
7.3.80.0140.01016.20
7.3.70.0170.00616.13
7.3.60.0040.01816.18
7.3.50.0140.01016.12
7.3.40.0100.01016.12
7.3.30.0130.01616.22
7.3.20.0200.00416.28
7.3.10.0150.00616.21
7.3.00.0180.00416.07
7.2.330.0080.00816.76
7.2.320.0030.01316.69
7.2.310.0090.01216.29
7.2.300.0150.00916.54
7.2.290.0150.00416.20
7.2.280.0230.01016.50
7.2.270.0150.01516.52
7.2.260.0150.00616.18
7.2.250.0100.01016.32
7.2.240.0210.00416.33
7.2.230.0150.00916.62
7.2.220.0200.00516.48
7.2.210.0190.00616.25
7.2.200.0080.01616.30
7.2.190.0210.00516.42
7.2.180.0130.01016.30
7.2.170.0120.00916.70
7.2.160.0230.00416.40
7.2.150.0120.01216.56
7.2.140.0170.00816.61
7.2.130.0130.01016.29
7.2.120.0110.01116.45
7.2.110.0150.00916.37
7.2.100.0150.00916.42
7.2.90.0180.00516.24
7.2.80.0130.01016.21
7.2.70.0150.00916.75
7.2.60.0180.00216.46
7.2.50.0170.01116.32
7.2.40.0130.01016.54
7.2.30.0160.00516.58
7.2.20.0390.01516.59
7.2.10.0210.00416.77
7.2.00.0100.00716.44

preferences:
142.86 ms | 403 KiB | 5 Q