3v4l.org

run code in 300+ PHP versions simultaneously
<?php $response = '{ "results" : [ { "address_components" : [ { "long_name" : "277", "short_name" : "277", "types" : [ "street_number" ] }, { "long_name" : "Bedford Avenue", "short_name" : "Bedford Ave", "types" : [ "route" ] }, { "long_name" : "Williamsburg", "short_name" : "Williamsburg", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "sublocality_level_1", "sublocality", "political" ] }, { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] }, { "long_name" : "11211", "short_name" : "11211", "types" : [ "postal_code" ] } ], "formatted_address" : "277 Bedford Ave, Brooklyn, NY 11211, USA", "geometry" : { "location" : { "lat" : 40.714232, "lng" : -73.9612889 }, "location_type" : "ROOFTOP", "viewport" : { "northeast" : { "lat" : 40.7155809802915, "lng" : -73.9599399197085 }, "southwest" : { "lat" : 40.7128830197085, "lng" : -73.96263788029151 } } }, "place_id" : "ChIJd8BlQ2BZwokRAFUEcm_qrcA", "types" : [ "street_address" ] }, { "address_components" : [ { "long_name" : "Grand St/Bedford Av", "short_name" : "Grand St/Bedford Av", "types" : [ "point_of_interest", "establishment" ] }, { "long_name" : "Williamsburg", "short_name" : "Williamsburg", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "sublocality_level_1", "sublocality", "political" ] }, { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] }, { "long_name" : "11211", "short_name" : "11211", "types" : [ "postal_code" ] } ], "formatted_address" : "Grand St/Bedford Av, Brooklyn, NY 11211, USA", "geometry" : { "location" : { "lat" : 40.714321, "lng" : -73.961151 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 40.71566998029149, "lng" : -73.95980201970849 }, "southwest" : { "lat" : 40.7129720197085, "lng" : -73.96249998029151 } } }, "place_id" : "ChIJi27VXGBZwokRM8ErPyB91yk", "types" : [ "bus_station", "transit_station", "point_of_interest", "establishment" ] }, { "address_components" : [ { "long_name" : "Williamsburg", "short_name" : "Williamsburg", "types" : [ "neighborhood", "political" ] }, { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "sublocality_level_1", "sublocality", "political" ] }, { "long_name" : "New York", "short_name" : "New York", "types" : [ "locality", "political" ] }, { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] } ], "formatted_address" : "Williamsburg, Brooklyn, NY, USA", "geometry" : { "bounds" : { "northeast" : { "lat" : 40.7251773, "lng" : -73.936498 }, "southwest" : { "lat" : 40.6979329, "lng" : -73.96984499999999 } }, "location" : { "lat" : 40.7081156, "lng" : -73.9570696 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 40.7251773, "lng" : -73.936498 }, "southwest" : { "lat" : 40.6979329, "lng" : -73.96984499999999 } } }, "place_id" : "ChIJQSrBBv1bwokRbNfFHCnyeYI", "types" : [ "neighborhood", "political" ] }, { "address_components" : [ { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "sublocality_level_1", "sublocality", "political" ] }, { "long_name" : "New York", "short_name" : "New York", "types" : [ "locality", "political" ] }, { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] } ], "formatted_address" : "Brooklyn, NY, USA", "geometry" : { "bounds" : { "northeast" : { "lat" : 40.739446, "lng" : -73.83336509999999 }, "southwest" : { "lat" : 40.551042, "lng" : -74.05663 } }, "location" : { "lat" : 40.6781784, "lng" : -73.94415789999999 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 40.739446, "lng" : -73.83336509999999 }, "southwest" : { "lat" : 40.551042, "lng" : -74.05663 } } }, "place_id" : "ChIJCSF8lBZEwokRhngABHRcdoI", "types" : [ "sublocality_level_1", "sublocality", "political" ] }, { "address_components" : [ { "long_name" : "New York", "short_name" : "New York", "types" : [ "locality", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] } ], "formatted_address" : "New York, NY, USA", "geometry" : { "bounds" : { "northeast" : { "lat" : 40.91525559999999, "lng" : -73.70027209999999 }, "southwest" : { "lat" : 40.4960439, "lng" : -74.25573489999999 } }, "location" : { "lat" : 40.7127837, "lng" : -74.0059413 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 40.91525559999999, "lng" : -73.70027209999999 }, "southwest" : { "lat" : 40.4960439, "lng" : -74.25573489999999 } } }, "place_id" : "ChIJOwg_06VPwokRYv534QaPC8g", "types" : [ "locality", "political" ] }, { "address_components" : [ { "long_name" : "11211", "short_name" : "11211", "types" : [ "postal_code" ] }, { "long_name" : "Brooklyn", "short_name" : "Brooklyn", "types" : [ "sublocality_level_1", "sublocality", "political" ] }, { "long_name" : "New York", "short_name" : "New York", "types" : [ "locality", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] } ], "formatted_address" : "Brooklyn, NY 11211, USA", "geometry" : { "bounds" : { "northeast" : { "lat" : 40.7280089, "lng" : -73.9207299 }, "southwest" : { "lat" : 40.7008331, "lng" : -73.9644697 } }, "location" : { "lat" : 40.7093358, "lng" : -73.9565551 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 40.7280089, "lng" : -73.9207299 }, "southwest" : { "lat" : 40.7008331, "lng" : -73.9644697 } } }, "place_id" : "ChIJvbEjlVdZwokR4KapM3WCFRw", "types" : [ "postal_code" ] }, { "address_components" : [ { "long_name" : "Kings County", "short_name" : "Kings County", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] } ], "formatted_address" : "Kings County, NY, USA", "geometry" : { "bounds" : { "northeast" : { "lat" : 40.7391407, "lng" : -73.83336509999999 }, "southwest" : { "lat" : 40.5702197, "lng" : -74.04195919999999 } }, "location" : { "lat" : 40.6528762, "lng" : -73.95949399999999 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 40.7391407, "lng" : -73.83336509999999 }, "southwest" : { "lat" : 40.5702197, "lng" : -74.04195919999999 } } }, "place_id" : "ChIJOwE7_GTtwokRs75rhW4_I6M", "types" : [ "administrative_area_level_2", "political" ] }, { "address_components" : [ { "long_name" : "New York", "short_name" : "NY", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] } ], "formatted_address" : "New York, USA", "geometry" : { "bounds" : { "northeast" : { "lat" : 45.015865, "lng" : -71.8562293 }, "southwest" : { "lat" : 40.496091, "lng" : -79.76214379999999 } }, "location" : { "lat" : 43.2994285, "lng" : -74.21793260000001 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 45.015859, "lng" : -71.8562293 }, "southwest" : { "lat" : 40.496091, "lng" : -79.76214379999999 } } }, "place_id" : "ChIJqaUj8fBLzEwRZ5UY3sHGz90", "types" : [ "administrative_area_level_1", "political" ] }, { "address_components" : [ { "long_name" : "United States", "short_name" : "US", "types" : [ "country", "political" ] } ], "formatted_address" : "United States", "geometry" : { "bounds" : { "northeast" : { "lat" : 71.3867745, "lng" : -66.9502861 }, "southwest" : { "lat" : 18.9106768, "lng" : 172.4458955 } }, "location" : { "lat" : 37.09024, "lng" : -95.712891 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 49.38, "lng" : -66.94 }, "southwest" : { "lat" : 25.82, "lng" : -124.39 } } }, "place_id" : "ChIJCzYy5IS16lQRQrfeQ5K5Oxw", "types" : [ "country", "political" ] } ], "status" : "OK" }'; $array = json_decode($response, TRUE); $iterator = new \RecursiveIteratorIterator( new \RecursiveArrayIterator($array), \RecursiveIteratorIterator::SELF_FIRST); // Recurse through the result array. When there is an array of items at the // expected depth that has the expected identifier as one of the keys, pull that // array out as a distinct item. $identifier = 'place_id'; $identifierDepth = 1; $items = []; while ($iterator->valid()) { $iterator->next(); $item = $iterator->current(); // Segfaults on last row from gmap data. if (is_array($item)) { if (array_key_exists($identifier, $item)) { if ( $iterator->getDepth() == $identifierDepth) { $items[] = $item; } } } } echo 'no error';

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.60.0090.00918.55
8.3.50.0100.00822.05
8.3.40.0160.00019.00
8.3.30.0130.00618.88
8.3.20.0000.00820.55
8.3.10.0080.00020.54
8.3.00.0030.00520.37
8.2.180.0070.00725.92
8.2.170.0070.00719.04
8.2.160.0070.00722.96
8.2.150.0050.00325.66
8.2.140.0040.00424.66
8.2.130.0040.00418.82
8.2.120.0040.00426.35
8.2.110.0030.00619.29
8.2.100.0060.00618.16
8.2.90.0060.00318.01
8.2.80.0030.00518.34
8.2.70.0050.00317.63
8.2.60.0030.00518.05
8.2.50.0060.00318.09
8.2.40.0060.00320.59
8.2.30.0040.00419.55
8.2.20.0000.01017.68
8.2.10.0080.00018.16
8.2.00.0000.01118.17
8.1.280.0060.01625.92
8.1.270.0070.00324.66
8.1.260.0040.00428.09
8.1.250.0040.00428.09
8.1.240.0100.00321.03
8.1.230.0060.00622.73
8.1.220.0030.00517.91
8.1.210.0080.00019.03
8.1.200.0040.00417.36
8.1.190.0050.00517.48
8.1.180.0000.00918.10
8.1.170.0030.00718.76
8.1.160.0040.00422.71
8.1.150.0050.00319.03
8.1.140.0000.00819.70
8.1.130.0040.00417.58
8.1.120.0000.00817.63
8.1.110.0040.00417.59
8.1.100.0000.00817.49
8.1.90.0000.00817.54
8.1.80.0080.00017.50
8.1.70.0000.00717.43
8.1.60.0000.00917.59
8.1.50.0060.00317.65
8.1.40.0080.00017.68
8.1.30.0080.00017.63
8.1.20.0060.00317.83
8.1.10.0040.00417.70
8.1.00.0000.00817.52
8.0.300.0040.00420.11
8.0.290.0040.00416.88
8.0.280.0040.00418.55
8.0.270.0040.00417.36
8.0.260.0000.00716.96
8.0.250.0000.00717.00
8.0.240.0080.00016.96
8.0.230.0040.00417.04
8.0.220.0040.00416.82
8.0.210.0000.00716.79
8.0.200.0070.00016.96
8.0.190.0040.00416.99
8.0.180.0030.00716.84
8.0.170.0030.00616.97
8.0.160.0000.00816.84
8.0.150.0040.00416.77
8.0.140.0000.00716.89
8.0.130.0000.00613.40
8.0.120.0030.00516.89
8.0.110.0060.00316.94
8.0.100.0000.00716.89
8.0.90.0030.00616.93
8.0.80.0130.00316.92
8.0.70.0050.00316.80
8.0.60.0000.00816.71
8.0.50.0070.00016.74
8.0.30.0020.01317.01
8.0.20.0060.01317.40
8.0.10.0040.00717.18
8.0.00.0120.01017.00
7.4.330.0000.00616.92
7.4.320.0030.00616.70
7.4.300.0030.00316.71
7.4.290.0000.00716.74
7.4.280.0000.00816.55
7.4.270.0030.00516.73
7.4.260.0040.00416.57
7.4.250.0030.00716.56
7.4.240.0040.00416.68
7.4.230.0040.00416.67
7.4.220.0120.01316.69
7.4.210.0070.00916.68
7.4.200.0020.00516.59
7.4.160.0110.00616.63
7.4.150.0120.00617.40
7.4.140.0160.00417.86
7.4.130.0070.01016.58
7.4.120.0080.01416.73
7.4.110.0110.01116.79
7.4.100.0070.01116.65
7.4.90.0140.00416.60
7.4.80.0160.00319.39
7.4.70.0110.00716.76
7.4.60.0120.00916.48
7.4.50.0080.00816.36
7.4.40.0100.00716.57
7.4.30.0060.01616.57
7.4.00.0060.01015.19
7.3.330.0000.00713.23
7.3.320.0050.00013.15
7.3.310.0000.00716.38
7.3.300.0040.00416.37
7.3.290.0070.00016.09
7.3.280.0080.00916.29
7.3.270.0100.00717.40
7.3.260.0110.01216.42
7.3.250.0090.00816.50
7.3.240.0130.00816.42
7.3.230.0100.00716.39
7.3.210.0140.00416.40
7.3.200.0130.00616.44
7.3.190.0060.00916.55
7.3.180.0130.00316.46
7.3.170.0120.00616.46
7.3.160.0150.00316.52
7.2.330.0140.00416.66
7.2.320.0060.01316.85
7.2.310.0120.01216.75
7.2.300.0120.00616.53
7.2.290.0100.00716.90
7.2.60.0070.00716.63
7.2.00.0120.00419.49
7.1.200.0060.00615.58
7.1.100.0030.01018.10
7.1.70.0040.00417.04
7.1.60.0100.01019.77
7.1.50.0040.01817.12
7.1.00.0030.07722.27
7.0.200.0000.00916.95
7.0.60.0170.04721.64
7.0.50.0170.06017.84
7.0.40.0100.08319.94
7.0.30.0230.04719.77
7.0.20.0370.06719.73
7.0.10.0100.08719.88
7.0.00.0100.07719.88
5.6.280.0070.07021.17
5.6.210.0030.08720.68
5.6.200.0070.04318.17
5.6.190.0000.05720.61
5.6.180.0230.07720.76
5.6.170.0270.08720.71
5.6.160.0030.09320.49
5.6.150.0100.06018.17
5.6.140.0100.08318.18
5.6.130.0030.04018.21
5.6.120.0130.07721.07
5.6.110.0000.05021.24
5.6.100.0070.08021.07
5.6.90.0070.09321.02
5.6.80.0070.07720.43
5.5.350.3830.03320.35
5.5.340.0100.08017.92
5.5.330.0030.04320.12
5.5.320.0330.08020.41
5.5.310.0300.07020.29
5.5.300.0070.03717.92
5.5.290.0100.05018.01
5.5.280.0100.03720.95
5.5.270.0130.07721.02
5.5.260.0100.07320.80
5.5.250.0100.07720.59
5.5.240.0270.06720.39

preferences:
62.45 ms | 401 KiB | 5 Q