3v4l.org

run code in 300+ PHP versions simultaneously
<?php $country_ids = range(1,5); $result['fields'][0]['field_type'] = "countries"; foreach ($country_ids as $id) { $result['fields'][0]['field_value'][] = ["country_id" => $id, "match_type" => "exact"]; } var_export($result); echo "\n---\n"; echo json_encode($result, JSON_PRETTY_PRINT); // this resembles your posted data

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.80.0080.00317.97
8.3.70.0070.01116.50
8.3.60.0070.00718.18
8.3.50.0120.00318.35
8.3.40.0100.00618.94
8.3.30.0040.01118.86
8.3.20.0110.00419.14
8.3.10.0000.00823.48
8.3.00.0040.00420.79
8.2.200.0030.00916.88
8.2.190.0070.00718.20
8.2.180.0110.00716.63
8.2.170.0040.01118.75
8.2.160.0000.01421.99
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00020.92
8.2.120.0040.00426.35
8.2.110.0070.00419.30
8.2.100.0040.00817.91
8.2.90.0030.00617.75
8.2.80.0070.00317.97
8.2.70.0000.00817.93
8.2.60.0040.00418.22
8.2.50.0030.00618.10
8.2.40.0040.00421.07
8.2.30.0070.00019.39
8.2.20.0040.00418.14
8.2.10.0000.00718.14
8.2.00.0000.00819.33
8.1.290.0120.00030.84
8.1.280.0090.00925.92
8.1.270.0040.00422.06
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0040.00419.28
8.1.230.0110.00017.65
8.1.220.0050.00317.76
8.1.210.0050.00318.77
8.1.200.0080.00017.35
8.1.190.0030.00617.35
8.1.180.0040.00418.10
8.1.170.0040.00418.40
8.1.160.0040.00418.93
8.1.150.0040.00418.90
8.1.140.0050.00322.20
8.1.130.0040.00420.19
8.1.120.0050.00217.49
8.1.110.0040.00417.43
8.1.100.0090.00017.39
8.1.90.0040.00717.46
8.1.80.0000.00717.37
8.1.70.0040.00417.46
8.1.60.0000.00917.64
8.1.50.0000.00817.57
8.1.40.0040.00417.42
8.1.30.0060.00317.63
8.1.20.0040.00417.66
8.1.10.0070.00017.64
8.1.00.0000.00917.52
8.0.300.0000.00718.77
8.0.290.0040.00416.63
8.0.280.0000.00718.50
8.0.270.0000.00717.32
8.0.260.0030.00318.36
8.0.250.0030.00317.02
8.0.240.0060.00316.95
8.0.230.0000.00716.98
8.0.220.0030.00316.79
8.0.210.0070.00016.80
8.0.200.0000.00616.96
8.0.190.0050.00216.84
8.0.180.0030.00516.82
8.0.170.0000.00816.96
8.0.160.0000.00816.80
8.0.150.0040.00416.81
8.0.140.0030.00316.84
8.0.130.0050.00013.31
8.0.120.0030.00616.93
8.0.110.0040.00416.81
8.0.100.0070.00016.78
8.0.90.0030.00416.75
8.0.80.0070.01116.96
8.0.70.0040.00416.80
8.0.60.0000.00816.77
8.0.50.0040.00416.78
8.0.30.0090.01217.25
8.0.20.0110.00717.40
8.0.10.0040.00416.89
8.0.00.0090.01216.80
7.4.330.0060.00015.55
7.4.320.0060.00316.46
7.4.300.0030.00316.52
7.4.290.0040.00416.58
7.4.280.0040.00416.39
7.4.270.0000.00716.43
7.4.260.0080.00016.52
7.4.250.0030.00316.61
7.4.240.0040.00416.46
7.4.230.0040.00416.41
7.4.220.0040.00416.61
7.4.210.0060.00916.57
7.4.200.0040.00416.61
7.4.160.0110.00816.47
7.4.140.0130.00717.86
7.4.130.0100.00716.54
7.4.120.0090.01016.51
7.4.110.0130.01016.35
7.4.100.0100.00616.43
7.4.90.0100.00716.45
7.4.80.0090.01619.39
7.4.70.0070.01016.52
7.4.60.0080.00816.41
7.4.50.0030.01216.25
7.4.40.0070.01016.58
7.4.00.0040.01114.63
7.3.330.0050.00013.20
7.3.320.0030.00313.16
7.3.310.0050.00316.32
7.3.300.0000.00716.27
7.3.290.0040.00416.31
7.3.280.0070.00716.34
7.3.260.0090.00916.44
7.3.240.0100.00916.48
7.3.230.0060.01016.39
7.3.210.0230.00016.28
7.3.200.0080.00816.62
7.3.190.0090.00816.32
7.3.180.0090.00616.65
7.3.170.0030.01516.30
7.3.160.0000.01516.38
7.2.330.0040.01416.74
7.2.320.0090.01216.56
7.2.310.0080.00816.53
7.2.300.0030.01516.39
7.2.290.0150.00316.84
7.2.120.0090.00916.59
7.2.110.0130.00316.72
7.2.100.0070.00716.48
7.2.90.0070.00716.77
7.2.80.0040.01116.78
7.2.70.0000.01316.89
7.2.60.0060.01016.75
7.2.50.0100.00716.92
7.2.40.0090.00316.65
7.2.30.0110.00716.63
7.2.20.0070.01016.98
7.2.10.0030.01016.81
7.2.00.0100.00617.04
7.1.240.0100.00315.96
7.1.230.0060.00915.83
7.1.220.0070.00715.97
7.1.210.0030.01015.72
7.1.200.0100.00715.63
7.1.190.0030.01315.94
7.1.180.0030.01315.75
7.1.170.0080.00315.79
7.1.160.0120.00315.45
7.1.150.0090.00615.68
7.1.140.0110.00415.72
7.1.130.0030.00915.82
7.1.120.0060.00615.57
7.1.110.0030.01015.71
7.1.100.0030.01015.87
7.1.90.0070.00715.80
7.1.80.0120.00315.85
7.1.70.0110.00415.78
7.1.60.0060.00915.77
7.1.50.0060.00915.64
7.1.40.0080.00315.47
7.1.30.0030.01215.68
7.1.20.0030.00915.79
7.1.10.0060.00615.80
7.1.00.0080.00515.58
5.6.380.0000.01414.56

preferences:
28.04 ms | 401 KiB | 5 Q