@ 2016-02-03T14:10:26Z <?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';
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
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).
Version System time (s) User time (s) Memory (MiB) 8.3.6 0.009 0.009 18.55 8.3.5 0.010 0.008 22.05 8.3.4 0.016 0.000 19.00 8.3.3 0.013 0.006 18.88 8.3.2 0.000 0.008 20.55 8.3.1 0.008 0.000 20.54 8.3.0 0.003 0.005 20.37 8.2.18 0.007 0.007 25.92 8.2.17 0.007 0.007 19.04 8.2.16 0.007 0.007 22.96 8.2.15 0.005 0.003 25.66 8.2.14 0.004 0.004 24.66 8.2.13 0.004 0.004 18.82 8.2.12 0.004 0.004 26.35 8.2.11 0.003 0.006 19.29 8.2.10 0.006 0.006 18.16 8.2.9 0.006 0.003 18.01 8.2.8 0.003 0.005 18.34 8.2.7 0.005 0.003 17.63 8.2.6 0.003 0.005 18.05 8.2.5 0.006 0.003 18.09 8.2.4 0.006 0.003 20.59 8.2.3 0.004 0.004 19.55 8.2.2 0.000 0.010 17.68 8.2.1 0.008 0.000 18.16 8.2.0 0.000 0.011 18.17 8.1.28 0.006 0.016 25.92 8.1.27 0.007 0.003 24.66 8.1.26 0.004 0.004 28.09 8.1.25 0.004 0.004 28.09 8.1.24 0.010 0.003 21.03 8.1.23 0.006 0.006 22.73 8.1.22 0.003 0.005 17.91 8.1.21 0.008 0.000 19.03 8.1.20 0.004 0.004 17.36 8.1.19 0.005 0.005 17.48 8.1.18 0.000 0.009 18.10 8.1.17 0.003 0.007 18.76 8.1.16 0.004 0.004 22.71 8.1.15 0.005 0.003 19.03 8.1.14 0.000 0.008 19.70 8.1.13 0.004 0.004 17.58 8.1.12 0.000 0.008 17.63 8.1.11 0.004 0.004 17.59 8.1.10 0.000 0.008 17.49 8.1.9 0.000 0.008 17.54 8.1.8 0.008 0.000 17.50 8.1.7 0.000 0.007 17.43 8.1.6 0.000 0.009 17.59 8.1.5 0.006 0.003 17.65 8.1.4 0.008 0.000 17.68 8.1.3 0.008 0.000 17.63 8.1.2 0.006 0.003 17.83 8.1.1 0.004 0.004 17.70 8.1.0 0.000 0.008 17.52 8.0.30 0.004 0.004 20.11 8.0.29 0.004 0.004 16.88 8.0.28 0.004 0.004 18.55 8.0.27 0.004 0.004 17.36 8.0.26 0.000 0.007 16.96 8.0.25 0.000 0.007 17.00 8.0.24 0.008 0.000 16.96 8.0.23 0.004 0.004 17.04 8.0.22 0.004 0.004 16.82 8.0.21 0.000 0.007 16.79 8.0.20 0.007 0.000 16.96 8.0.19 0.004 0.004 16.99 8.0.18 0.003 0.007 16.84 8.0.17 0.003 0.006 16.97 8.0.16 0.000 0.008 16.84 8.0.15 0.004 0.004 16.77 8.0.14 0.000 0.007 16.89 8.0.13 0.000 0.006 13.40 8.0.12 0.003 0.005 16.89 8.0.11 0.006 0.003 16.94 8.0.10 0.000 0.007 16.89 8.0.9 0.003 0.006 16.93 8.0.8 0.013 0.003 16.92 8.0.7 0.005 0.003 16.80 8.0.6 0.000 0.008 16.71 8.0.5 0.007 0.000 16.74 8.0.3 0.002 0.013 17.01 8.0.2 0.006 0.013 17.40 8.0.1 0.004 0.007 17.18 8.0.0 0.012 0.010 17.00 7.4.33 0.000 0.006 16.92 7.4.32 0.003 0.006 16.70 7.4.30 0.003 0.003 16.71 7.4.29 0.000 0.007 16.74 7.4.28 0.000 0.008 16.55 7.4.27 0.003 0.005 16.73 7.4.26 0.004 0.004 16.57 7.4.25 0.003 0.007 16.56 7.4.24 0.004 0.004 16.68 7.4.23 0.004 0.004 16.67 7.4.22 0.012 0.013 16.69 7.4.21 0.007 0.009 16.68 7.4.20 0.002 0.005 16.59 7.4.16 0.011 0.006 16.63 7.4.15 0.012 0.006 17.40 7.4.14 0.016 0.004 17.86 7.4.13 0.007 0.010 16.58 7.4.12 0.008 0.014 16.73 7.4.11 0.011 0.011 16.79 7.4.10 0.007 0.011 16.65 7.4.9 0.014 0.004 16.60 7.4.8 0.016 0.003 19.39 7.4.7 0.011 0.007 16.76 7.4.6 0.012 0.009 16.48 7.4.5 0.008 0.008 16.36 7.4.4 0.010 0.007 16.57 7.4.3 0.006 0.016 16.57 7.4.0 0.006 0.010 15.19 7.3.33 0.000 0.007 13.23 7.3.32 0.005 0.000 13.15 7.3.31 0.000 0.007 16.38 7.3.30 0.004 0.004 16.37 7.3.29 0.007 0.000 16.09 7.3.28 0.008 0.009 16.29 7.3.27 0.010 0.007 17.40 7.3.26 0.011 0.012 16.42 7.3.25 0.009 0.008 16.50 7.3.24 0.013 0.008 16.42 7.3.23 0.010 0.007 16.39 7.3.21 0.014 0.004 16.40 7.3.20 0.013 0.006 16.44 7.3.19 0.006 0.009 16.55 7.3.18 0.013 0.003 16.46 7.3.17 0.012 0.006 16.46 7.3.16 0.015 0.003 16.52 7.2.33 0.014 0.004 16.66 7.2.32 0.006 0.013 16.85 7.2.31 0.012 0.012 16.75 7.2.30 0.012 0.006 16.53 7.2.29 0.010 0.007 16.90 7.2.6 0.007 0.007 16.63 7.2.0 0.012 0.004 19.49 7.1.20 0.006 0.006 15.58 7.1.10 0.003 0.010 18.10 7.1.7 0.004 0.004 17.04 7.1.6 0.010 0.010 19.77 7.1.5 0.004 0.018 17.12 7.1.0 0.003 0.077 22.27 7.0.20 0.000 0.009 16.95 7.0.6 0.017 0.047 21.64 7.0.5 0.017 0.060 17.84 7.0.4 0.010 0.083 19.94 7.0.3 0.023 0.047 19.77 7.0.2 0.037 0.067 19.73 7.0.1 0.010 0.087 19.88 7.0.0 0.010 0.077 19.88 5.6.28 0.007 0.070 21.17 5.6.21 0.003 0.087 20.68 5.6.20 0.007 0.043 18.17 5.6.19 0.000 0.057 20.61 5.6.18 0.023 0.077 20.76 5.6.17 0.027 0.087 20.71 5.6.16 0.003 0.093 20.49 5.6.15 0.010 0.060 18.17 5.6.14 0.010 0.083 18.18 5.6.13 0.003 0.040 18.21 5.6.12 0.013 0.077 21.07 5.6.11 0.000 0.050 21.24 5.6.10 0.007 0.080 21.07 5.6.9 0.007 0.093 21.02 5.6.8 0.007 0.077 20.43 5.5.35 0.383 0.033 20.35 5.5.34 0.010 0.080 17.92 5.5.33 0.003 0.043 20.12 5.5.32 0.033 0.080 20.41 5.5.31 0.030 0.070 20.29 5.5.30 0.007 0.037 17.92 5.5.29 0.010 0.050 18.01 5.5.28 0.010 0.037 20.95 5.5.27 0.013 0.077 21.02 5.5.26 0.010 0.073 20.80 5.5.25 0.010 0.077 20.59 5.5.24 0.027 0.067 20.39
preferences:dark mode live preview
62.45 ms | 401 KiB | 5 Q