3v4l.org

run code in 300+ PHP versions simultaneously
<?php // some address values $client_address = '11010 Langton Arms Court'; $client_city = 'Oakton'; $client_state = 'VA'; $client_zip = '22124'; // building the JSON URL string for Google API call $g_address = str_replace(' ', '+', trim($client_address)).","; $g_city = '+'.str_replace(' ', '+', trim($client_city)).","; $g_state = '+'.str_replace(' ', '+', trim($client_state)); $g_zip = isset($client_zip)? '+'.str_replace(' ', '', trim($client_zip)) : ''; $g_addr_str = $g_address.$g_city.$g_state.$g_zip; $url = "http://maps.google.com/maps/api/geocode/json? address=$g_addr_str&sensor=false"; // Parsing the JSON response from the Google Geocode API to get exact map coordinates: // latitude , longitude (see the Google doc. for the complete data return here: // https://developers.google.com/maps/documentation/geocoding/.) $jsonData = file_get_contents($url); $data = json_decode($jsonData); $xlat = $data->{'results'}[0]->{'geometry'}->{'location'}->{'lat'}; $xlong = $data->{'results'}[0]->{'geometry'}->{'location'}->{'lng'}; echo $xlat.",".$xlong;
Output for 8.3.0 - 8.3.4
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo for maps.google.com failed: System error in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): Failed to open stream: php_network_getaddresses: getaddrinfo for maps.google.com failed: System error in /in/Xcp1i on line 23 Warning: Attempt to read property "results" on null in /in/Xcp1i on line 27 Warning: Trying to access array offset on null in /in/Xcp1i on line 27 Warning: Attempt to read property "geometry" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "location" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "lat" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "results" on null in /in/Xcp1i on line 28 Warning: Trying to access array offset on null in /in/Xcp1i on line 28 Warning: Attempt to read property "geometry" on null in /in/Xcp1i on line 28 Warning: Attempt to read property "location" on null in /in/Xcp1i on line 28 Warning: Attempt to read property "lng" on null in /in/Xcp1i on line 28 ,
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo for maps.google.com failed: System error in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): Failed to open stream: php_network_getaddresses: getaddrinfo for maps.google.com failed: System error in /in/Xcp1i on line 23 Warning: Attempt to read property "results" on null in /in/Xcp1i on line 27 Warning: Trying to access array offset on value of type null in /in/Xcp1i on line 27 Warning: Attempt to read property "geometry" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "location" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "lat" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "results" on null in /in/Xcp1i on line 28 Warning: Trying to access array offset on value of type null in /in/Xcp1i on line 28 Warning: Attempt to read property "geometry" on null in /in/Xcp1i on line 28 Warning: Attempt to read property "location" on null in /in/Xcp1i on line 28 Warning: Attempt to read property "lng" on null in /in/Xcp1i on line 28 ,
Output for 8.0.13 - 8.0.30
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): Failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/Xcp1i on line 23 Warning: Attempt to read property "results" on null in /in/Xcp1i on line 27 Warning: Trying to access array offset on value of type null in /in/Xcp1i on line 27 Warning: Attempt to read property "geometry" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "location" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "lat" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "results" on null in /in/Xcp1i on line 28 Warning: Trying to access array offset on value of type null in /in/Xcp1i on line 28 Warning: Attempt to read property "geometry" on null in /in/Xcp1i on line 28 Warning: Attempt to read property "location" on null in /in/Xcp1i on line 28 Warning: Attempt to read property "lng" on null in /in/Xcp1i on line 28 ,
Output for 8.0.0 - 8.0.12
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): Failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/Xcp1i on line 23 Warning: Attempt to read property "results" on null in /in/Xcp1i on line 27 Warning: Trying to access array offset on value of type null in /in/Xcp1i on line 27 Warning: Attempt to read property "geometry" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "location" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "lat" on null in /in/Xcp1i on line 27 Warning: Attempt to read property "results" on null in /in/Xcp1i on line 28 Warning: Trying to access array offset on value of type null in /in/Xcp1i on line 28 Warning: Attempt to read property "geometry" on null in /in/Xcp1i on line 28 Warning: Attempt to read property "location" on null in /in/Xcp1i on line 28 Warning: Attempt to read property "lng" on null in /in/Xcp1i on line 28 ,
Output for 7.4.0, 7.4.26 - 7.4.33
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/Xcp1i on line 23 Notice: Trying to get property 'results' of non-object in /in/Xcp1i on line 27 Notice: Trying to access array offset on value of type null in /in/Xcp1i on line 27 Notice: Trying to get property 'geometry' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'location' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'lat' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'results' of non-object in /in/Xcp1i on line 28 Notice: Trying to access array offset on value of type null in /in/Xcp1i on line 28 Notice: Trying to get property 'geometry' of non-object in /in/Xcp1i on line 28 Notice: Trying to get property 'location' of non-object in /in/Xcp1i on line 28 Notice: Trying to get property 'lng' of non-object in /in/Xcp1i on line 28 ,
Output for 7.4.3 - 7.4.25
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/Xcp1i on line 23 Notice: Trying to get property 'results' of non-object in /in/Xcp1i on line 27 Notice: Trying to access array offset on value of type null in /in/Xcp1i on line 27 Notice: Trying to get property 'geometry' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'location' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'lat' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'results' of non-object in /in/Xcp1i on line 28 Notice: Trying to access array offset on value of type null in /in/Xcp1i on line 28 Notice: Trying to get property 'geometry' of non-object in /in/Xcp1i on line 28 Notice: Trying to get property 'location' of non-object in /in/Xcp1i on line 28 Notice: Trying to get property 'lng' of non-object in /in/Xcp1i on line 28 ,
Output for 7.3.32 - 7.3.33
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/Xcp1i on line 23 ,
Output for 7.2.29 - 7.2.33, 7.3.16 - 7.3.31
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /in/Xcp1i on line 23 Notice: Trying to get property 'results' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'geometry' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'location' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'lat' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'results' of non-object in /in/Xcp1i on line 28 Notice: Trying to get property 'geometry' of non-object in /in/Xcp1i on line 28 Notice: Trying to get property 'location' of non-object in /in/Xcp1i on line 28 Notice: Trying to get property 'lng' of non-object in /in/Xcp1i on line 28 ,
Output for 7.2.0 - 7.2.6
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/Xcp1i on line 23 Notice: Trying to get property 'results' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'geometry' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'location' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'lat' of non-object in /in/Xcp1i on line 27 Notice: Trying to get property 'results' of non-object in /in/Xcp1i on line 28 Notice: Trying to get property 'geometry' of non-object in /in/Xcp1i on line 28 Notice: Trying to get property 'location' of non-object in /in/Xcp1i on line 28 Notice: Trying to get property 'lng' of non-object in /in/Xcp1i on line 28 ,
Output for 5.5.33, 5.6.18 - 5.6.19, 7.0.4, 7.0.20, 7.1.5 - 7.1.20
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: System error in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): failed to open stream: php_network_getaddresses: getaddrinfo failed: System error in /in/Xcp1i on line 23 Notice: Trying to get property of non-object in /in/Xcp1i on line 27 Notice: Trying to get property of non-object in /in/Xcp1i on line 27 Notice: Trying to get property of non-object in /in/Xcp1i on line 27 Notice: Trying to get property of non-object in /in/Xcp1i on line 27 Notice: Trying to get property of non-object in /in/Xcp1i on line 28 Notice: Trying to get property of non-object in /in/Xcp1i on line 28 Notice: Trying to get property of non-object in /in/Xcp1i on line 28 Notice: Trying to get property of non-object in /in/Xcp1i on line 28 ,
Output for 5.5.24 - 5.5.32, 5.5.34 - 5.5.35, 5.6.8 - 5.6.17, 5.6.20 - 5.6.28, 7.0.0 - 7.0.3, 7.0.5 - 7.0.6, 7.1.0
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/Xcp1i on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124&sensor=false): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in /in/Xcp1i on line 23 Notice: Trying to get property of non-object in /in/Xcp1i on line 27 Notice: Trying to get property of non-object in /in/Xcp1i on line 27 Notice: Trying to get property of non-object in /in/Xcp1i on line 27 Notice: Trying to get property of non-object in /in/Xcp1i on line 27 Notice: Trying to get property of non-object in /in/Xcp1i on line 28 Notice: Trying to get property of non-object in /in/Xcp1i on line 28 Notice: Trying to get property of non-object in /in/Xcp1i on line 28 Notice: Trying to get property of non-object in /in/Xcp1i on line 28 ,

preferences:
171.28 ms | 404 KiB | 179 Q