3v4l.org

run code in 300+ PHP versions simultaneously
<?php $locations = [ ['country'=>'USA', 'state'=>'New York', 'city'=>'NYC', 'location'=>'Central Park', 'street'=>'7th Ave', 'count'=>123], ['country'=>'USA', 'state'=>'Maryland', 'city'=>'Baltimore', 'location'=>'Harber', 'count'=>24], ['country'=>'USA', 'state'=>'Michigan', 'city'=>'Lansing', 'location'=>'Midtown', 'building'=>'H2B', 'count'=>7], ['country'=>'France', 'state'=>'Sud', 'city'=>'Marseille', 'location'=>'Centre Ville', 'count'=>12], ]; $hierarchy = array(); $levels = array_reverse( array('country', 'state', 'city', 'location') ); $lastLevel = 'count'; foreach ( $locations as $L ) { $array = $L[$lastLevel]; foreach ( $levels as $level ) { $array = array($L[$level] => $array); } $hierarchy = array_merge_recursive($hierarchy, $array); } print_r($hierarchy);

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.3.130.0000.00818.22
8.3.120.0100.01018.95
8.3.110.0040.00420.94
8.3.100.0160.00324.06
8.3.90.0040.00426.77
8.3.80.0030.00617.97
8.3.70.0120.00318.55
8.3.60.0040.01116.63
8.3.50.0200.01522.03
8.3.40.0040.01418.84
8.3.30.0080.00818.57
8.3.20.0040.00421.91
8.3.10.0070.00021.85
8.3.00.0080.00018.16
8.2.250.0100.00018.15
8.2.240.0000.00919.09
8.2.230.0050.00322.58
8.2.220.0050.00337.54
8.2.210.0060.01326.77
8.2.200.0090.00018.54
8.2.190.0140.00716.58
8.2.180.0040.01916.50
8.2.170.0140.00722.96
8.2.160.0070.00722.12
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0050.00322.26
8.2.120.0000.00826.35
8.2.110.0030.00820.57
8.2.100.0110.00017.84
8.2.90.0030.00617.97
8.2.80.0000.00819.07
8.2.70.0050.00318.05
8.2.60.0040.00418.03
8.2.50.0030.00718.10
8.2.40.0050.00220.45
8.2.30.0040.00419.25
8.2.20.0030.00617.83
8.2.10.0000.00718.17
8.2.00.0070.00017.99
8.1.300.0070.01117.68
8.1.290.0110.00030.84
8.1.280.0080.00825.92
8.1.270.0040.00423.71
8.1.260.0050.00328.09
8.1.250.0030.00528.09
8.1.240.0070.00319.12
8.1.230.0070.00420.89
8.1.220.0080.00017.77
8.1.210.0060.00318.77
8.1.200.0050.00317.23
8.1.190.0030.00517.10
8.1.180.0040.00418.10
8.1.170.0050.00318.67
8.1.160.0000.00722.13
8.1.150.0000.00720.77
8.1.140.0040.00419.50
8.1.130.0040.00417.33
8.1.120.0030.00317.35
8.1.110.0050.00317.49
8.1.100.0040.00417.38
8.1.90.0030.00617.36
8.1.80.0000.00717.49
8.1.70.0070.00017.43
8.1.60.0040.00417.61
8.1.50.0060.00317.52
8.1.40.0040.00417.50
8.1.30.0000.00917.59
8.1.20.0000.00817.71
8.1.10.0030.00517.53
8.1.00.0080.00017.45
8.0.300.0080.00020.16
8.0.290.0040.00416.63
8.0.280.0000.00718.41
8.0.270.0070.00017.26
8.0.260.0030.00316.93
8.0.250.0040.00416.85
8.0.240.0090.00016.82
8.0.230.0000.00716.95
8.0.220.0080.00016.77
8.0.210.0030.00316.85
8.0.200.0030.00316.99
8.0.190.0030.00616.86
8.0.180.0000.00816.81
8.0.170.0020.00516.87
8.0.160.0040.00416.79
8.0.150.0000.00816.75
8.0.140.0030.00316.91
8.0.130.0050.00013.30
8.0.120.0040.00416.81
8.0.110.0000.00816.69
8.0.100.0040.00416.76
8.0.90.0000.00716.89
8.0.80.0090.00616.77
8.0.70.0030.00516.90
8.0.60.0080.00016.86
8.0.50.0040.00416.84
8.0.30.0100.00617.05
8.0.20.0130.01017.40
8.0.10.0000.00716.87
8.0.00.0110.00716.76
7.4.330.0050.00015.09
7.4.320.0000.00616.55
7.4.300.0060.00016.49
7.4.290.0040.00416.51
7.4.280.0080.00016.60
7.4.270.0030.00316.50
7.4.260.0060.00316.63
7.4.250.0070.00016.46
7.4.240.0040.00416.51
7.4.230.0030.00316.60
7.4.220.0250.00016.68
7.4.210.0100.00516.70
7.4.200.0030.00316.51
7.4.160.0100.00516.38
7.4.150.0120.00617.40
7.4.140.0170.00617.86
7.4.130.0150.00616.44
7.4.120.0080.01216.64
7.4.110.0150.00416.59
7.4.100.0100.01316.57
7.4.90.0070.01016.38
7.4.80.0090.01219.39
7.4.70.0060.01016.65
7.4.60.0090.01216.51
7.4.50.0030.01216.57
7.4.40.0030.01416.55
7.4.30.0100.00616.57
7.4.00.0030.01314.90
7.3.330.0050.00013.08
7.3.320.0000.00613.13
7.3.310.0000.00716.30
7.3.300.0000.00716.27
7.3.290.0030.00316.32
7.3.280.0110.00616.36
7.3.270.0110.01117.40
7.3.260.0100.00716.28
7.3.250.0110.00616.52
7.3.240.0070.01016.44
7.3.230.0100.00716.63
7.3.210.0140.00416.42
7.3.200.0070.01016.46
7.3.190.0100.01016.52
7.3.180.0150.00316.45
7.3.170.0130.00616.21
7.3.160.0060.00916.71
7.2.330.0090.00916.54
7.2.320.0060.01116.54
7.2.310.0000.01716.61
7.2.300.0060.01516.71
7.2.290.0070.01116.79
7.2.00.0070.00719.48
7.1.70.0030.00817.17
7.1.60.0080.00319.75
7.1.00.0030.07722.29
7.0.200.0350.00415.02
7.0.90.0270.05719.96
7.0.80.0100.06319.95
7.0.70.0200.07320.02
7.0.60.0300.07020.00
7.0.50.0170.06720.26
7.0.40.0200.05320.36
7.0.30.0230.06020.23
7.0.20.0170.06020.32
7.0.10.0170.06020.38
7.0.00.0270.08020.35
5.6.240.0170.05720.81
5.6.230.0130.06020.69
5.6.220.0270.05720.62
5.6.210.0200.07020.87
5.6.200.0200.05721.14
5.6.190.0270.05321.06
5.6.180.0100.08321.16
5.6.170.0070.06721.20
5.6.160.0300.06721.02
5.6.150.0170.07721.09
5.6.140.0100.06721.05
5.6.130.0230.06321.05
5.6.120.0030.08721.02
5.6.110.0270.05021.10
5.6.100.0200.05321.07
5.6.90.0030.06721.00
5.6.80.0070.06020.46
5.6.70.0230.04720.44
5.6.60.0270.04720.45
5.6.50.0170.05720.52
5.6.40.0230.06020.48
5.6.30.0130.07720.46
5.6.20.0230.06320.42
5.6.10.0200.05020.47
5.6.00.0070.07020.52

preferences:
27.63 ms | 403 KiB | 5 Q