3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rates = array( 'apple' => array( 'red' => 1.19, 'green' => 0.99, 'yellow' => 0.89 ) ); $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][$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.10.0080.00019.34
8.3.140.0030.00718.91
8.3.130.0040.00418.58
8.3.120.0040.00420.61
8.3.110.0040.01518.38
8.3.100.0060.00316.76
8.3.90.0000.00826.77
8.3.80.0070.00316.63
8.3.70.0120.00818.43
8.3.60.0120.00918.68
8.3.50.0140.00724.48
8.3.40.0170.00318.57
8.3.30.0140.00018.79
8.3.20.0050.00324.18
8.3.10.0050.00324.66
8.3.00.0060.00326.16
8.2.260.0040.00716.42
8.2.250.0090.00616.50
8.2.240.0030.00717.07
8.2.230.0060.00920.94
8.2.220.0160.00024.06
8.2.210.0060.00626.77
8.2.200.0060.00316.38
8.2.190.0100.01016.58
8.2.180.0140.00725.92
8.2.170.0090.00618.83
8.2.160.0100.00322.96
8.2.150.0070.00025.66
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0120.00619.45
8.2.110.0070.00319.30
8.2.100.0090.00317.72
8.2.90.0000.01017.63
8.2.80.0080.00018.05
8.2.70.0030.00517.63
8.2.60.0000.00718.05
8.2.50.0000.00818.07
8.2.40.0050.00319.95
8.2.30.0040.00418.11
8.2.20.0050.00318.18
8.2.10.0040.00419.19
8.2.00.0040.00419.22
8.1.310.0070.01016.77
8.1.300.0030.00618.44
8.1.290.0040.00430.84
8.1.280.0070.01025.92
8.1.270.0040.01122.05
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0080.00323.66
8.1.230.0030.00920.93
8.1.220.0000.00817.74
8.1.210.0030.00618.77
8.1.200.0000.00817.35
8.1.190.0000.00817.25
8.1.180.0000.00819.19
8.1.170.0000.00918.68
8.1.160.0030.00618.89
8.1.150.0000.00718.89
8.1.140.0000.00818.84
8.1.130.0070.00020.14
8.1.120.0030.00317.51
8.1.110.0030.00617.44
8.1.100.0030.00617.51
8.1.90.0000.00717.45
8.1.80.0070.00017.41
8.1.70.0090.00017.32
8.1.60.0040.00417.65
8.1.50.0040.00417.55
8.1.40.0080.00017.55
8.1.30.0030.00917.65
8.1.20.0020.00517.60
8.1.10.0000.00917.55
8.1.00.0020.00517.49
8.0.300.0070.00019.65
8.0.290.0060.00316.63
8.0.280.0000.00818.45
8.0.270.0030.00318.01
8.0.260.0070.00018.49
8.0.250.0070.00016.98
8.0.240.0030.00316.95
8.0.230.0030.00316.95
8.0.220.0040.00416.79
8.0.210.0000.00716.90
8.0.200.0030.00316.98
8.0.190.0000.00816.88
8.0.180.0030.00316.96
8.0.170.0040.00416.93
8.0.160.0070.00016.95
8.0.150.0000.00816.84
8.0.140.0070.00016.74
8.0.130.0030.00313.32
8.0.120.0040.00416.91
8.0.110.0070.00016.76
8.0.100.0070.00016.84
8.0.90.0030.00316.76
8.0.80.0070.01016.85
8.0.70.0040.00416.88
8.0.60.0030.00416.79
8.0.50.0050.00216.75
8.0.30.0100.00717.15
8.0.20.0110.01017.17
8.0.10.0080.00016.84
8.0.00.0100.01016.81
7.4.330.0020.00215.55
7.4.320.0060.00016.61
7.4.300.0000.00616.64
7.4.290.0030.00316.59
7.4.280.0030.00516.43
7.4.270.0040.00416.60
7.4.260.0000.00513.28
7.4.250.0070.00016.54
7.4.240.0050.00216.59
7.4.230.0070.00016.48
7.4.220.0040.00416.64
7.4.210.0060.01116.56
7.4.200.0030.00316.30
7.4.130.0080.01116.60
7.4.120.0120.01216.58
7.4.110.0110.00716.50
7.4.100.0080.00816.25
7.4.90.0100.00616.32
7.4.80.0120.00619.39
7.4.70.0160.00716.66
7.4.60.0070.01416.44
7.4.50.0130.01016.48
7.4.40.0160.00616.64
7.4.30.0000.01716.40
7.4.20.0060.01416.12
7.4.10.0090.01216.07
7.4.00.0030.01916.71
7.3.330.0040.00416.31
7.3.320.0060.00013.07
7.3.310.0000.00716.19
7.3.300.0000.00716.34
7.3.290.0070.00816.36
7.3.280.0100.01016.27
7.3.260.0090.01516.31
7.3.230.0090.00916.41
7.3.210.0040.01316.55
7.3.200.0090.00616.30
7.3.190.0150.00316.39
7.3.180.0030.01516.35
7.3.170.0130.01016.20
7.3.160.0120.00716.39
7.3.150.0070.01016.21
7.3.140.0130.00916.30
7.3.130.0170.00716.43
7.3.120.0080.01116.37
7.3.110.0060.01716.44
7.3.100.0110.00816.35
7.3.90.0070.01116.35
7.3.80.0090.00916.50
7.3.70.0110.01116.53
7.3.60.0090.00916.26
7.3.50.0120.01016.44
7.3.40.0090.00916.45
7.3.30.0000.02216.37
7.3.20.0140.00516.38
7.3.10.0120.00916.38
7.3.00.0090.00916.53
7.2.330.0130.00616.64
7.2.320.0060.00916.55
7.2.310.0130.00816.60
7.2.300.0080.01016.56
7.2.290.0110.00916.57
7.2.280.0140.01316.79
7.2.270.0150.00916.36
7.2.260.0160.00616.44
7.2.250.0070.01416.70
7.2.240.0060.01316.54
7.2.230.0140.00816.77
7.2.220.0110.01416.65
7.2.210.0100.01316.76
7.2.200.0150.00316.45
7.2.190.0090.01616.42
7.2.180.0060.01216.73
7.2.170.0160.00716.72
7.2.160.0090.00916.68
7.2.150.0080.01116.70
7.2.140.0120.00816.80
7.2.130.0150.00916.70
7.2.120.0110.00716.64
7.2.110.0150.00416.62
7.2.100.0120.01216.59
7.2.90.0100.01316.73
7.2.80.0150.00716.60
7.2.70.0060.01716.74
7.2.60.0190.00416.58
7.2.50.0030.01516.55
7.2.40.0490.01316.46
7.2.30.0160.01016.67
7.2.20.0110.00816.64
7.2.10.0130.00716.34
7.2.00.0090.01516.70

preferences:
68.56 ms | 403 KiB | 5 Q