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"; // 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 git.master, git.master_jit
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo for maps.google.com failed: System error in /in/tPXWE on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124): Failed to open stream: php_network_getaddresses: getaddrinfo for maps.google.com failed: System error in /in/tPXWE on line 23 Warning: Attempt to read property "results" on null in /in/tPXWE on line 27 Warning: Trying to access array offset on value of type null in /in/tPXWE on line 27 Warning: Attempt to read property "geometry" on null in /in/tPXWE on line 27 Warning: Attempt to read property "location" on null in /in/tPXWE on line 27 Warning: Attempt to read property "lat" on null in /in/tPXWE on line 27 Warning: Attempt to read property "results" on null in /in/tPXWE on line 28 Warning: Trying to access array offset on value of type null in /in/tPXWE on line 28 Warning: Attempt to read property "geometry" on null in /in/tPXWE on line 28 Warning: Attempt to read property "location" on null in /in/tPXWE on line 28 Warning: Attempt to read property "lng" on null in /in/tPXWE on line 28 ,
Output for rfc.property-hooks
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo for maps.google.com failed: System error in /in/tPXWE on line 23 Warning: file_get_contents(http://maps.google.com/maps/api/geocode/json? address=11010+Langton+Arms+Court,+Oakton,+VA+22124): Failed to open stream: php_network_getaddresses: getaddrinfo for maps.google.com failed: System error in /in/tPXWE on line 23 Warning: Attempt to read property "results" on null in /in/tPXWE on line 27 Warning: Trying to access array offset on null in /in/tPXWE on line 27 Warning: Attempt to read property "geometry" on null in /in/tPXWE on line 27 Warning: Attempt to read property "location" on null in /in/tPXWE on line 27 Warning: Attempt to read property "lat" on null in /in/tPXWE on line 27 Warning: Attempt to read property "results" on null in /in/tPXWE on line 28 Warning: Trying to access array offset on null in /in/tPXWE on line 28 Warning: Attempt to read property "geometry" on null in /in/tPXWE on line 28 Warning: Attempt to read property "location" on null in /in/tPXWE on line 28 Warning: Attempt to read property "lng" on null in /in/tPXWE on line 28 ,

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
62.65 ms | 403 KiB | 8 Q