You forgot a semi colon ; at the end of $ur
$ur= "http://maps.googleapis.com/maps/api/place/nearbysearch/json?
location=".$la.",".$lo."&radius=10&sensor=true&key=AIzaSyA0JD_Z2Uo2AfnDTejQFWHAXOIaRRpjF8c";
Question
i'm got error what is this problem? how i get echo getAddress ?i'm tried eny time to fix that?
function getAddress($la, $lo){
$ur= "http://maps.googleapis.com/maps/api/place/nearbysearch/json?location=".$la.",".$lo."&radius=10&sensor=true&key=AIzaSyA0JD_Z2Uo2AfnDTejQFWHAXOIaRRpjF8c"
$json = file_get_contents($ur);
$data = json_decode($json);
$status = $data->status;
$name= '';
if($status == "OK"){
$addr = $data->results[0]->formatted_address;
}
return $addr;
}
echo getAddress("6.154841","80.700845");
Solution
You forgot a semi colon ; at the end of $ur
$ur= "http://maps.googleapis.com/maps/api/place/nearbysearch/json?
location=".$la.",".$lo."&radius=10&sensor=true&key=AIzaSyA0JD_Z2Uo2AfnDTejQFWHAXOIaRRpjF8c";