I want to create an array, json_encode
it, then send it off via echo
. The array needs to be created from the following server response I'm getting from an external API:
someName([{"lat":"35.7804015","lon":"-78.6390779"}])
I want to do something like this:
$lat = someName['lat']; // this doesn't work
$lon = someName['lon']; // this doesn't work
$data = array('lat'=> $lat, 'lon'=> $lon);
echo json_encode($data);
The problem is that I'm not getting the data from "someName". What am I doing wrong?