3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "shops": [ { "shop_id": "100", "locations": [ { "location_id": "100_1", "distance": "10.3" }, { "location_id": "100_2", "distance": "15.2" } ] }, { "shop_id": "101", "locations": [ { "location_id": "101_1", "distance": "19.3" }, { "location_id": "101_2", "distance": "12.4" } ] }] }'; // Decode the JSON data $json_data = json_decode($json,true); // Do a foreach loop foreach($json_data['shops'] as $shops) { $distances = array_column($shops['locations'], 'distance','location_id'); asort($distances); echo key($distances) . ' -> ' . current($distances) . "\n"; }

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.0090.00217.63
8.4.120.0070.01224.08
8.4.110.0110.00922.32
8.4.100.0120.00917.91
8.4.90.0060.00318.84
8.4.80.0050.00419.46
8.4.70.0130.00817.61
8.4.60.0070.01318.48
8.4.50.0140.00617.88
8.4.40.0060.01317.90
8.4.30.0170.00317.64
8.4.20.0100.01020.49
8.4.10.0000.00919.48
8.3.260.0080.01016.55
8.3.250.0090.00919.12
8.3.240.0050.00316.98
8.3.230.0130.00516.55
8.3.220.0110.00517.05
8.3.210.0110.00916.54
8.3.200.0040.00416.58
8.3.190.0130.00616.64
8.3.180.0050.00316.74
8.3.170.0120.00617.14
8.3.160.0090.00616.45
8.3.150.0080.00817.41
8.3.140.0040.00416.54
8.3.130.0060.00318.19
8.3.120.0030.01718.95
8.3.110.0080.00816.38
8.3.100.0040.01524.06
8.3.90.0060.00326.77
8.3.80.0030.00716.50
8.3.70.0120.00316.58
8.3.60.0100.00618.24
8.3.50.0090.00818.08
8.3.40.0090.00618.66
8.3.30.0060.00918.52
8.3.20.0020.00521.90
8.3.10.0080.00020.71
8.3.00.0000.00817.63
8.2.290.0130.00620.51
8.2.280.0050.00418.54
8.2.270.0030.00616.70
8.2.260.0090.00918.73
8.2.250.0060.00918.35
8.2.240.0080.00018.70
8.2.230.0000.00820.94
8.2.220.0030.00637.54
8.2.210.0050.00326.77
8.2.200.0000.01016.50
8.2.190.0090.00616.63
8.2.180.0060.01025.92
8.2.170.0150.00018.77
8.2.160.0100.00322.96
8.2.150.0090.00625.66
8.2.140.0050.00224.66
8.2.130.0040.00426.16
8.2.120.0030.00917.93
8.2.110.0030.00620.58
8.2.100.0140.00017.91
8.2.90.0040.00417.75
8.2.80.0060.00318.73
8.2.70.0090.00017.75
8.2.60.0030.00518.04
8.2.50.0080.00018.07
8.2.40.0080.00018.16
8.2.30.0000.00818.12
8.2.20.0070.00018.12
8.2.10.0040.00419.19
8.2.00.0040.00418.18
8.1.330.0090.01021.82
8.1.320.0080.01116.21
8.1.310.0070.01016.93
8.1.300.0060.01318.28
8.1.290.0060.00618.88
8.1.280.0000.01525.92
8.1.270.0040.00424.66
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0000.00918.96
8.1.230.0040.00717.70
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0090.00017.25
8.1.190.0040.00417.35
8.1.180.0050.00318.10
8.1.170.0000.00718.75
8.1.160.0040.00418.89
8.1.150.0040.00418.80
8.1.140.0040.00418.81
8.1.130.0070.00420.13
8.1.120.0000.00717.35
8.1.110.0040.00417.46
8.1.100.0050.00317.46
8.1.90.0040.00417.37
8.1.80.0040.00417.52
8.1.70.0030.00317.52
8.1.60.0030.00817.47
8.1.50.0000.00717.40
8.1.40.0100.00017.51
8.1.30.0050.00317.59
8.1.20.0080.00017.61
8.1.10.0000.00817.62
8.1.00.0050.00217.45
8.0.300.0000.00818.77
8.0.290.0030.00516.63
8.0.280.0000.00718.45
8.0.270.0000.00817.32
8.0.260.0030.00318.35
8.0.250.0040.00417.00
8.0.240.0000.00717.00
8.0.230.0040.00416.84
8.0.220.0000.00716.90
8.0.210.0070.00016.91
8.0.200.0060.00016.87
8.0.190.0000.00816.84
8.0.180.0070.00016.77
8.0.170.0000.00916.81
8.0.160.0050.00216.87
8.0.150.0000.00716.91
8.0.140.0050.00316.86
8.0.130.0060.00013.31
8.0.120.0000.00816.82
8.0.110.0040.00416.93
8.0.100.0000.00716.79
8.0.90.0050.00316.82
8.0.80.0030.01316.91
8.0.70.0040.00416.71
8.0.60.0070.00016.72
8.0.50.0080.00016.85
8.0.30.0060.00916.91
8.0.20.0070.01317.08
8.0.10.0040.00416.99
8.0.00.0100.01116.72
7.4.330.0050.00015.55
7.4.320.0000.00616.54
7.4.300.0060.00016.61
7.4.290.0030.00316.60
7.4.280.0040.00416.58
7.4.270.0030.00316.61
7.4.260.0000.00816.57
7.4.250.0070.00016.37
7.4.240.0070.00016.61
7.4.230.0070.00016.41
7.4.220.0000.00716.61
7.4.210.0090.00816.52
7.4.200.0030.00316.67
7.4.160.0130.00716.41
7.4.140.0140.00517.86
7.4.130.0110.00716.72
7.4.120.0130.01416.64
7.4.110.0130.01116.66
7.4.100.0120.01316.39
7.4.90.0070.01016.43
7.4.80.0110.00719.39
7.4.70.0100.00716.60
7.4.60.0080.00816.49
7.4.50.0120.00616.34
7.4.40.0070.01016.57
7.4.10.0080.00815.13
7.4.00.0030.01215.18
7.3.330.0020.00213.20
7.3.320.0030.00313.10
7.3.310.0000.00716.22
7.3.300.0000.00716.25
7.3.290.0000.00716.16
7.3.280.0090.00616.17
7.3.260.0120.00816.44
7.3.240.0080.01116.47
7.3.230.0130.00316.39
7.3.210.0060.01016.26
7.3.200.0110.00816.23
7.3.190.0080.00816.57
7.3.180.0130.00316.36
7.3.170.0100.01016.48
7.3.160.0100.00716.32
7.3.130.0070.00715.08
7.3.120.0110.00414.76
7.3.110.0040.01414.72
7.3.100.0120.00315.01
7.3.90.0060.01114.63
7.3.80.0060.01215.08
7.3.70.0030.00914.77
7.3.60.0000.01514.59
7.3.50.0080.00414.47
7.3.40.0040.00714.87
7.3.30.0070.00714.66
7.3.20.0000.01316.65
7.3.10.0470.01015.26
7.3.00.2300.00815.43
7.2.330.0120.00616.52
7.2.320.0100.01316.88
7.2.310.0060.01616.78
7.2.300.0080.00816.30
7.2.290.0120.00616.85
7.2.260.0030.01415.24
7.2.250.0070.01115.06
7.2.240.0060.00814.81
7.2.230.0040.01214.88
7.2.220.0070.01015.03
7.2.210.0040.00814.97
7.2.200.0000.01215.06
7.2.190.0030.01315.25
7.2.180.0030.01015.13
7.2.170.0060.01014.88
7.2.160.0060.00915.11
7.2.150.0030.00917.02
7.2.140.0050.00517.00
7.2.130.2020.00916.05
7.2.120.2620.00516.02
7.2.110.2340.00515.83
7.2.100.2450.00415.97
7.2.90.2290.00915.65
7.2.80.0600.00615.83
7.2.70.0260.01315.96
7.2.60.1460.00815.79
7.2.50.4080.00315.99
7.2.40.3210.01315.86
7.2.30.2600.00715.94
7.2.20.2070.01315.83
7.2.10.1300.00816.08
7.2.00.1330.00615.90
7.1.330.0030.01015.53
7.1.320.0040.01115.98
7.1.310.0030.01015.86
7.1.300.0070.01015.93
7.1.290.0000.00815.86
7.1.280.0030.01015.46
7.1.270.0070.00715.34
7.1.260.0030.00715.75
7.1.250.2050.01014.81
7.1.240.0070.00415.82
7.1.230.0000.01715.71
7.1.220.0030.00915.88
7.1.210.0060.00615.78
7.1.200.0000.01815.81
7.1.190.0000.01615.86
7.1.180.0070.01015.40
7.1.170.0000.01315.48
7.1.160.0000.01315.87
7.1.150.0060.00615.86
7.1.140.0070.00715.88
7.1.130.0060.00815.70
7.1.120.0000.01015.80
7.1.110.0040.00815.87
7.1.100.0090.00615.68
7.1.90.0060.00915.75
7.1.80.0090.00015.91
7.1.70.0070.00715.94
7.1.60.0060.00615.69
7.1.50.0000.01315.84
7.1.40.0080.00815.70
7.1.30.0070.00715.59
7.1.20.0100.00715.80
7.1.10.0000.00915.80
7.1.00.0000.01415.76

preferences:
27.41 ms | 403 KiB | 5 Q