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'); $locations = array_column($shops['locations'], 'location_id'); $min = min($distances); $location = array_search($min, $distances); echo $locations[$location] . ' -> ' . $min . "\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.0130.00717.55
8.4.120.0090.01120.71
8.4.110.0120.00822.60
8.4.100.0130.00817.77
8.4.90.0070.00918.84
8.4.80.0110.00820.46
8.4.70.0040.00418.04
8.4.60.0140.00618.72
8.4.50.0100.01219.65
8.4.40.0080.00017.66
8.4.30.0130.00717.96
8.4.20.0130.00720.59
8.4.10.0100.00019.59
8.3.260.0070.01116.56
8.3.250.0100.00919.04
8.3.240.0060.01017.04
8.3.230.0090.01016.64
8.3.220.0130.00518.96
8.3.210.0140.00616.66
8.3.200.0050.00416.74
8.3.190.0100.00816.66
8.3.180.0120.00716.52
8.3.170.0030.00617.17
8.3.160.0180.00018.34
8.3.150.0110.00720.89
8.3.140.0110.00417.01
8.3.130.0050.00318.43
8.3.120.0200.00018.79
8.3.110.0030.00620.94
8.3.100.0080.00024.06
8.3.90.0050.00326.77
8.3.80.0050.00517.97
8.3.70.0120.00618.14
8.3.60.0100.01018.55
8.3.50.0070.01118.36
8.3.40.0120.00618.97
8.3.30.0110.00818.75
8.3.20.0050.00321.93
8.3.10.0040.00420.66
8.3.00.0060.00317.63
8.2.290.0090.00920.27
8.2.280.0050.00318.58
8.2.270.0150.00319.05
8.2.260.0090.00917.40
8.2.250.0080.00016.74
8.2.240.0150.00017.16
8.2.230.0100.01022.58
8.2.220.0030.00637.54
8.2.210.0040.00426.77
8.2.200.0060.00316.38
8.2.190.0160.00016.82
8.2.180.0190.00316.75
8.2.170.0070.01022.96
8.2.160.0080.00522.09
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0080.00318.09
8.2.120.0000.00826.35
8.2.110.0030.00620.35
8.2.100.0070.00417.97
8.2.90.0060.00318.48
8.2.80.0080.00019.21
8.2.70.0130.00017.50
8.2.60.0050.00317.93
8.2.50.0050.00518.07
8.2.40.0020.00518.34
8.2.30.0040.00418.20
8.2.20.0070.00018.14
8.2.10.0040.00419.20
8.2.00.0050.00318.11
8.1.330.0100.00921.79
8.1.320.0090.01016.43
8.1.310.0060.01218.63
8.1.300.0070.00716.11
8.1.290.0030.00530.84
8.1.280.0070.01125.92
8.1.270.0070.00020.43
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.00722.74
8.1.230.0040.00819.73
8.1.220.0040.00417.75
8.1.210.0080.00018.77
8.1.200.0030.00617.23
8.1.190.0040.00417.25
8.1.180.0000.00818.10
8.1.170.0040.00418.51
8.1.160.0000.00719.07
8.1.150.0000.00818.66
8.1.140.0000.00718.90
8.1.130.0050.00219.27
8.1.120.0030.00517.52
8.1.110.0030.00717.42
8.1.100.0000.00717.37
8.1.90.0110.00017.45
8.1.80.0000.00817.45
8.1.70.0050.00217.39
8.1.60.0080.00017.46
8.1.50.0000.00817.56
8.1.40.0060.00317.44
8.1.30.0100.00017.68
8.1.20.0030.00517.64
8.1.10.0080.00017.58
8.1.00.0000.00917.38
8.0.300.0030.00718.77
8.0.290.0070.00016.63
8.0.280.0030.00318.45
8.0.270.0040.00417.25
8.0.260.0000.00616.84
8.0.250.0060.00016.93
8.0.240.0030.00316.86
8.0.230.0000.00716.95
8.0.220.0000.00716.80
8.0.210.0000.00716.77
8.0.200.0070.00016.98
8.0.190.0040.00416.90
8.0.180.0000.00716.95
8.0.170.0000.00816.80
8.0.160.0080.00016.98
8.0.150.0000.00716.83
8.0.140.0000.00716.84
8.0.130.0030.00313.28
8.0.120.0000.00716.91
8.0.110.0000.00716.94
8.0.100.0070.00017.03
8.0.90.0080.00016.93
8.0.80.0080.00816.94
8.0.70.0020.00516.73
8.0.60.0040.00416.97
8.0.50.0000.00716.96
8.0.30.0110.00917.09
8.0.20.0140.01117.40
8.0.10.0000.00717.05
8.0.00.0140.00616.68
7.4.330.0050.00015.55
7.4.320.0000.00616.50
7.4.300.0000.00716.53
7.4.290.0070.00016.61
7.4.280.0050.00216.59
7.4.270.0040.00416.51
7.4.260.0040.00416.59
7.4.250.0070.00016.50
7.4.240.0070.00016.61
7.4.230.0000.00716.53
7.4.220.0000.00716.65
7.4.210.0090.00516.64
7.4.200.0030.00316.44
7.4.160.0090.00916.56
7.4.140.0090.00917.86
7.4.130.0170.00316.66
7.4.120.0190.00316.54
7.4.110.0110.00816.46
7.4.100.0150.00416.49
7.4.90.0120.00516.46
7.4.80.0080.01217.79
7.4.70.0100.00716.43
7.4.60.0100.00916.52
7.4.50.0110.00516.28
7.4.40.0120.00416.35
7.4.30.0060.01116.44
7.4.20.0100.00716.28
7.4.10.0090.00916.42
7.4.00.0070.01215.60
7.3.330.0000.00513.26
7.3.320.0000.00513.23
7.3.310.0040.00416.18
7.3.300.0040.00416.36
7.3.290.0070.00016.32
7.3.280.0080.00716.15
7.3.260.0100.00916.55
7.3.240.0070.01116.44
7.3.230.0090.00616.45
7.3.210.0060.01116.40
7.3.200.0090.00516.28
7.3.190.0080.01016.30
7.3.180.0120.00516.49
7.3.170.0120.00716.36
7.3.160.0080.01016.45
7.3.150.0120.00916.34
7.3.140.0110.01116.36
7.3.130.0100.01016.38
7.3.120.0090.00916.27
7.3.110.0130.00816.20
7.3.100.0110.00716.47
7.3.90.0150.00716.33
7.3.80.0110.00715.95
7.3.70.0060.01316.19
7.3.60.0000.01616.31
7.3.50.0150.00316.36
7.3.40.0100.01316.16
7.3.30.0070.01116.41
7.3.20.0140.00716.21
7.3.10.0490.00715.12
7.3.00.0200.01315.42
7.2.330.0080.01116.66
7.2.320.0120.00816.59
7.2.310.0110.00816.53
7.2.300.0140.00716.66
7.2.290.0090.01116.68
7.2.280.0090.00916.82
7.2.270.0060.01216.67
7.2.260.0100.01316.67
7.2.250.0070.01016.67
7.2.240.0100.00816.57
7.2.230.0090.00916.58
7.2.220.0170.00316.30
7.2.210.0170.00416.32
7.2.200.0160.00316.34
7.2.190.0060.01416.51
7.2.180.0140.00616.54
7.2.170.0110.01316.54
7.2.160.0070.01416.35
7.2.150.0120.00816.51
7.2.140.0040.01616.44
7.2.130.0260.00515.78
7.2.120.0150.01515.70
7.2.110.0210.00715.78
7.2.100.0260.00915.80
7.2.90.0170.01015.76
7.2.80.0230.00615.86
7.2.70.0210.01415.57
7.2.60.0290.00815.85
7.2.50.0240.01015.49
7.2.40.0190.00715.68
7.2.30.0210.00515.82
7.2.20.0220.00515.57
7.2.10.0240.00515.73
7.2.00.0180.00915.77
7.1.330.0290.00815.61
7.1.320.0250.00615.48
7.1.310.0180.01015.68
7.1.300.0190.00815.52
7.1.290.0280.00715.49
7.1.280.0210.00715.62
7.1.270.0190.00815.52
7.1.260.0270.00415.75
7.1.250.0330.00714.68
7.1.240.0220.00915.73
7.1.230.0240.00615.44
7.1.220.0460.00815.52
7.1.210.0200.01015.49
7.1.200.0180.01115.75
7.1.190.0360.00015.54
7.1.180.0200.01315.60
7.1.170.0140.01415.55
7.1.160.0210.00915.51
7.1.150.0130.01715.46
7.1.140.0210.00715.54
7.1.130.0220.00515.47
7.1.120.0250.00315.52
7.1.110.0220.00715.52
7.1.100.0160.02015.57
7.1.90.0220.01315.50
7.1.80.0300.00815.63
7.1.70.0160.01315.72
7.1.60.0190.00815.54
7.1.50.0270.00015.66
7.1.40.0240.00315.73
7.1.30.0160.01215.56
7.1.20.0250.01615.57
7.1.10.0250.00715.56
7.1.00.0270.00815.63

preferences:
28.04 ms | 403 KiB | 5 Q