3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "results" : [ { "address_components" : [ { "long_name" : "P9/10", "short_name" : "P9/10", "types" : [ "premise" ] }, { "long_name" : "Pochanpur Colony", "short_name" : "Pochanpur Colony", "types" : [ "political", "sublocality", "sublocality_level_2" ] }, { "long_name" : "Dwarka", "short_name" : "Dwarka", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "Delhi", "short_name" : "Delhi", "types" : [ "locality", "political" ] }, { "long_name" : "South West Delhi", "short_name" : "South West Delhi", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "Delhi", "short_name" : "DL", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "India", "short_name" : "IN", "types" : [ "country", "political" ] }, { "long_name" : "110075", "short_name" : "110075", "types" : [ "postal_code" ] } ], "formatted_address" : "P9/10, Pochanpur Colony, Dwarka, Delhi, 110075, India", "geometry" : { "location" : { "lat" : 28.563945, "lng" : 77.04248679999999 }, "location_type" : "ROOFTOP", "viewport" : { "northeast" : { "lat" : 28.5652939802915, "lng" : 77.0438357802915 }, "southwest" : { "lat" : 28.5625960197085, "lng" : 77.0411378197085 } } }, "place_id" : "ChIJ0zkWBPcaDTkR8OpAXK17Qp8", "types" : [ "street_address" ] }, { "address_components" : [ { "long_name" : "Pocket 8", "short_name" : "Pocket 8", "types" : [ "establishment", "point_of_interest" ] }, { "long_name" : "Kala Ata Chakki", "short_name" : "Kala Ata Chakki", "types" : [ "route" ] }, { "long_name" : "Dhul Siras", "short_name" : "Dhul Siras", "types" : [ "political", "sublocality", "sublocality_level_2" ] }, { "long_name" : "Dwarka", "short_name" : "Dwarka", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "Delhi", "short_name" : "Delhi", "types" : [ "locality", "political" ] }, { "long_name" : "South West Delhi", "short_name" : "South West Delhi", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "Delhi", "short_name" : "DL", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "India", "short_name" : "IN", "types" : [ "country", "political" ] }, { "long_name" : "110075", "short_name" : "110075", "types" : [ "postal_code" ] } ], "formatted_address" : "Pocket 8, Dwarka Sector 23 B, Kala Ata Chakki, Dhul Siras, Dwarka, Delhi, 110075, India", "geometry" : { "location" : { "lat" : 28.5628438, "lng" : 77.0427552 }, "location_type" : "GEOMETRIC_CENTER", "viewport" : { "northeast" : { "lat" : 28.5641927802915, "lng" : 77.04410418029151 }, "southwest" : { "lat" : 28.5614948197085, "lng" : 77.04140621970849 } } }, "place_id" : "ChIJnYkGsPcaDTkRYBzk95MrbgM", "types" : [ "establishment", "point_of_interest" ] }, { "address_components" : [ { "long_name" : "Dhul Siras", "short_name" : "Dhul Siras", "types" : [ "political", "sublocality", "sublocality_level_2" ] }, { "long_name" : "Dwarka", "short_name" : "Dwarka", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "Delhi", "short_name" : "Delhi", "types" : [ "locality", "political" ] }, { "long_name" : "South West Delhi", "short_name" : "South West Delhi", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "Delhi", "short_name" : "DL", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "India", "short_name" : "IN", "types" : [ "country", "political" ] } ], "formatted_address" : "Dhul Siras, Dwarka, Delhi, India", "geometry" : { "bounds" : { "northeast" : { "lat" : 28.5667969, "lng" : 77.04649479999999 }, "southwest" : { "lat" : 28.551814, "lng" : 77.0272779 } }, "location" : { "lat" : 28.5641729, "lng" : 77.0413344 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 28.5667969, "lng" : 77.04649479999999 }, "southwest" : { "lat" : 28.561422, "lng" : 77.03926439999999 } } }, "place_id" : "ChIJhSDHK2EaDTkRETqqvXgJpaY", "types" : [ "political", "sublocality", "sublocality_level_2" ] }, { "address_components" : [ { "long_name" : "Dwarka", "short_name" : "Dwarka", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "long_name" : "New Delhi", "short_name" : "New Delhi", "types" : [ "locality", "political" ] }, { "long_name" : "South West Delhi", "short_name" : "South West Delhi", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "Delhi", "short_name" : "DL", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "India", "short_name" : "IN", "types" : [ "country", "political" ] } ], "formatted_address" : "Dwarka, New Delhi, Delhi, India", "geometry" : { "bounds" : { "northeast" : { "lat" : 28.6208451, "lng" : 77.0851753 }, "southwest" : { "lat" : 28.5257751, "lng" : 77.00929099999999 } }, "location" : { "lat" : 28.5921401, "lng" : 77.04604809999999 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 28.6208451, "lng" : 77.0851753 }, "southwest" : { "lat" : 28.5257751, "lng" : 77.00929099999999 } } }, "place_id" : "ChIJ4cTuMZwaDTkRmsiky3Y5STk", "types" : [ "political", "sublocality", "sublocality_level_1" ] }, { "address_components" : [ { "long_name" : "Delhi", "short_name" : "Delhi", "types" : [ "locality", "political" ] }, { "long_name" : "Delhi", "short_name" : "DL", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "India", "short_name" : "IN", "types" : [ "country", "political" ] } ], "formatted_address" : "Delhi, India", "geometry" : { "bounds" : { "northeast" : { "lat" : 28.88284, "lng" : 77.34488 }, "southwest" : { "lat" : 28.50197, "lng" : 76.8378199 } }, "location" : { "lat" : 28.6618976, "lng" : 77.2273958 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 28.88284, "lng" : 77.34488 }, "southwest" : { "lat" : 28.50197, "lng" : 76.8378199 } } }, "place_id" : "ChIJL_P_CXMEDTkRw0ZdG-0GVvw", "types" : [ "locality", "political" ] }, { "address_components" : [ { "long_name" : "110075", "short_name" : "110075", "types" : [ "postal_code" ] }, { "long_name" : "New Delhi", "short_name" : "New Delhi", "types" : [ "locality", "political" ] }, { "long_name" : "South West Delhi", "short_name" : "South West Delhi", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "Delhi", "short_name" : "DL", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "India", "short_name" : "IN", "types" : [ "country", "political" ] } ], "formatted_address" : "New Delhi, Delhi 110075, India", "geometry" : { "bounds" : { "northeast" : { "lat" : 28.6062045, "lng" : 77.07717749999999 }, "southwest" : { "lat" : 28.5547049, "lng" : 77.0103792 } }, "location" : { "lat" : 28.5899848, "lng" : 77.0443796 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 28.6062045, "lng" : 77.07717749999999 }, "southwest" : { "lat" : 28.5547049, "lng" : 77.0103792 } } }, "place_id" : "ChIJY690SeQaDTkRDlww_BqyZd8", "types" : [ "postal_code" ] }, { "address_components" : [ { "long_name" : "South West Delhi", "short_name" : "South West Delhi", "types" : [ "administrative_area_level_2", "political" ] }, { "long_name" : "Delhi", "short_name" : "DL", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "India", "short_name" : "IN", "types" : [ "country", "political" ] } ], "formatted_address" : "South West Delhi, Delhi, India", "geometry" : { "bounds" : { "northeast" : { "lat" : 28.67243, "lng" : 77.10914989999999 }, "southwest" : { "lat" : 28.50197, "lng" : 76.8378199 } }, "location" : { "lat" : 28.5928929, "lng" : 77.03461639999999 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 28.67243, "lng" : 77.10914989999999 }, "southwest" : { "lat" : 28.50197, "lng" : 76.8378199 } } }, "place_id" : "ChIJxbsO85oaDTkRGDJ4ocUr_Qw", "types" : [ "administrative_area_level_2", "political" ] }, { "address_components" : [ { "long_name" : "Delhi", "short_name" : "DL", "types" : [ "administrative_area_level_1", "political" ] }, { "long_name" : "India", "short_name" : "IN", "types" : [ "country", "political" ] } ], "formatted_address" : "Delhi, India", "geometry" : { "bounds" : { "northeast" : { "lat" : 28.881338, "lng" : 77.34845780000001 }, "southwest" : { "lat" : 28.412593, "lng" : 76.83806899999999 } }, "location" : { "lat" : 28.7040592, "lng" : 77.10249019999999 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 28.881338, "lng" : 77.34845780000001 }, "southwest" : { "lat" : 28.412593, "lng" : 76.83806899999999 } } }, "place_id" : "ChIJLbZ-NFv9DDkRQJY4FbcFcgM", "types" : [ "administrative_area_level_1", "political" ] }, { "address_components" : [ { "long_name" : "India", "short_name" : "IN", "types" : [ "country", "political" ] } ], "formatted_address" : "India", "geometry" : { "bounds" : { "northeast" : { "lat" : 35.5087008, "lng" : 97.39535869999999 }, "southwest" : { "lat" : 6.4626999, "lng" : 68.1097 } }, "location" : { "lat" : 20.593684, "lng" : 78.96288 }, "location_type" : "APPROXIMATE", "viewport" : { "northeast" : { "lat" : 35.5087008, "lng" : 97.39498069999999 }, "southwest" : { "lat" : 6.7535159, "lng" : 68.16288519999999 } } }, "place_id" : "ChIJkbeSa_BfYzARphNChaFPjNc", "types" : [ "country", "political" ] } ], "status" : "OK" }'; function getAddress($elements){ $addr = []; foreach($elements as $e){ if(isset($e['types']) && in_array("street_number",$e['types'])) $addr['street_number'] = $e['long_name']; if(isset($e['types']) && in_array("street_number",$e['types'])) $addr['route'] = $e['long_name']; if(isset($e['types']) && in_array("administrative_area_level_2",$e['types'])) $addr['city'] = $e['long_name']; } return $addr; } $obj = json_decode($json, true); $c = $obj['results'][0]['address_components']; var_dump(getAddress($c));

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.0180.00316.50
8.3.50.0070.00716.46
8.3.40.0180.00418.83
8.3.30.0090.00618.64
8.3.20.0100.00320.27
8.3.10.0090.00022.02
8.3.00.0060.00317.90
8.2.180.0000.01418.41
8.2.170.0090.00622.96
8.2.160.0030.01020.47
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00421.04
8.2.120.0040.00426.35
8.2.110.0060.00322.16
8.2.100.0040.00718.34
8.2.90.0040.00419.38
8.2.80.0040.00418.16
8.2.70.0030.00617.88
8.2.60.0000.01018.12
8.2.50.0040.00418.18
8.2.40.0030.00520.55
8.2.30.0040.00419.36
8.2.20.0050.00318.34
8.2.10.0060.00318.23
8.2.00.0040.00418.23
8.1.280.0130.00325.92
8.1.270.0090.00023.99
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0100.00020.73
8.1.230.0120.00017.50
8.1.220.0060.00317.77
8.1.210.0030.00518.77
8.1.200.0030.00617.38
8.1.190.0040.00417.47
8.1.180.0040.00418.10
8.1.170.0060.00318.80
8.1.160.0040.00419.14
8.1.150.0040.00420.68
8.1.140.0020.00519.58
8.1.130.0030.00718.92
8.1.120.0000.00717.60
8.1.110.0030.00617.47
8.1.100.0030.00617.64
8.1.90.0040.00417.61
8.1.80.0000.00717.48
8.1.70.0040.00417.47
8.1.60.0040.00417.70
8.1.50.0080.00017.61
8.1.40.0040.00417.65
8.1.30.0040.00417.81
8.1.20.0030.00517.70
8.1.10.0000.00817.63
8.1.00.0060.00317.61
8.0.300.0000.00818.77
8.0.290.0030.00516.88
8.0.280.0000.00718.48
8.0.270.0040.00417.40
8.0.260.0000.00716.80
8.0.250.0000.00717.11
8.0.240.0000.00717.04
8.0.230.0000.00817.04
8.0.220.0030.00316.88
8.0.210.0030.00317.00
8.0.200.0030.00316.95
8.0.190.0060.00317.12
8.0.180.0040.00716.91
8.0.170.0000.00717.02
8.0.160.0050.00317.01
8.0.150.0000.00816.88
8.0.140.0000.00716.96
8.0.130.0000.00613.43
8.0.120.0000.00716.87
8.0.110.0040.00416.93
8.0.100.0050.00216.99
8.0.90.0050.00217.00
8.0.80.0000.01617.03
8.0.70.0040.00416.82
8.0.60.0000.00816.82
8.0.50.0000.00816.90
8.0.30.0100.00817.26
8.0.20.0120.00717.40
8.0.10.0070.00017.05
8.0.00.0040.01316.77
7.4.330.0050.00015.55
7.4.320.0000.00716.62
7.4.300.0040.00416.73
7.4.290.0030.00516.70
7.4.280.0050.00316.61
7.4.270.0070.00016.61
7.4.260.0000.00813.38
7.4.250.0030.00416.55
7.4.240.0040.00416.57
7.4.230.0040.00416.66
7.4.220.0040.01516.65
7.4.210.0130.00616.65
7.4.200.0050.00316.50
7.4.160.0060.00916.63
7.4.150.0090.00917.40
7.4.140.0110.00917.86
7.4.130.0120.01016.55
7.4.120.0100.01016.59
7.4.110.0170.00016.53
7.4.100.0030.01716.53
7.4.90.0060.01116.82
7.4.80.0110.00919.39
7.4.70.0030.01316.65
7.4.60.0040.01216.73
7.4.50.0130.00316.52
7.4.40.0070.01016.38
7.4.30.0100.00716.72
7.4.00.0070.01015.22
7.3.330.0030.00313.35
7.3.320.0000.00513.41
7.3.310.0040.00416.37
7.3.300.0000.00716.47
7.3.290.0030.00616.47
7.3.280.0080.00716.46
7.3.270.0140.01117.40
7.3.260.0150.00716.68
7.3.250.0120.00916.56
7.3.240.0060.01116.50
7.3.230.0120.00716.49
7.3.210.0060.01216.57
7.3.200.0080.00816.62
7.3.190.0090.00916.61
7.3.180.0110.00616.59
7.3.170.0070.01016.61
7.3.160.0160.00016.67
7.3.10.0050.00816.52
7.3.00.0040.00716.48
7.2.330.0150.00316.56
7.2.320.0000.01616.84
7.2.310.0140.01016.61
7.2.300.0090.01516.68
7.2.290.0130.00316.85
7.2.130.0040.00916.82
7.2.120.0110.00316.83
7.2.110.0070.00516.94
7.2.100.0040.01116.68
7.2.90.0040.01016.81
7.2.80.0080.01016.64
7.2.70.0020.00817.01
7.2.60.0080.00816.91
7.2.50.0060.00816.79
7.2.40.0080.00516.89
7.2.30.0070.00916.64
7.2.20.0070.00816.93
7.2.10.0070.00616.82
7.2.00.0060.00717.46
7.1.250.0100.00515.86
7.1.240.0100.00615.90
7.1.230.0090.00915.84
7.1.220.0000.00815.95
7.1.210.0000.01015.84
7.1.200.0070.00515.70
7.1.190.0000.01415.88
7.1.180.0030.01015.94
7.1.170.0100.00315.89
7.1.160.0000.00815.63
7.1.150.0000.01015.82
7.1.140.0070.00715.73
7.1.130.0040.00815.83
7.1.120.0110.00415.98
7.1.110.0030.00715.73
7.1.100.0050.00916.85
7.1.90.0070.00315.67
7.1.80.0070.00315.93
7.1.70.0020.00716.31
7.1.60.0040.00716.63
7.1.50.0130.00316.37
7.1.40.0040.00916.13
7.1.30.0050.00716.21
7.1.20.0060.00616.34
7.1.10.0050.00616.03
7.1.00.0010.00816.32
7.0.330.0100.00315.31
7.0.320.0060.00315.47
7.0.310.0030.00915.30
7.0.300.0030.01015.30
7.0.290.0060.00615.29
7.0.280.0090.00315.36
7.0.270.0060.00315.51
7.0.260.0040.00415.33
7.0.250.0030.00615.56
7.0.240.0070.00715.52
7.0.230.0030.00915.46
7.0.220.0030.01015.05
7.0.210.0030.00715.30
7.0.200.0060.00216.06
7.0.190.0070.00316.08
7.0.180.0030.00715.75
7.0.170.0050.00615.81
7.0.160.0020.00815.68
7.0.150.0030.00515.89
7.0.140.0080.00515.94
7.0.130.0020.00816.07
7.0.120.0060.00316.02
7.0.110.0080.00716.10
7.0.100.0030.00615.88
7.0.90.0060.00215.72
7.0.80.0030.00815.80
7.0.70.0040.00515.99
7.0.60.0050.00415.77
7.0.50.0020.01115.94
7.0.40.0040.00714.15
7.0.30.0050.00614.08
7.0.20.0020.00714.15
7.0.10.0060.00914.23
7.0.00.0040.00914.21
5.6.380.0030.01014.35

preferences:
30.59 ms | 401 KiB | 5 Q