Link to home
Start Free TrialLog in
Avatar of jimfrith
jimfrith

asked on

parsing php string for lat and long

Im using an http request to get data that looks like this.

$xml = map.centerAndZoom(new GPoint(-82.81649, 42.175552), 4);

how can I parse this string to get the lat and long only.

$lat =
$long =
ASKER CERTIFIED SOLUTION
Avatar of glcummins
glcummins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jimfrith
jimfrith

ASKER

thanks for that
Avatar of Steve Bink
In case the string position changes, you can try this:

<?
$str = '$xml = map.centerAndZoom(new GPoint(-82.81649, 42.175552), 4);';
$m = "/GPoint\(([\-0-9.]+), ([\-0-9.]+)\)/";
$a=array();
preg_match($m, $str, $a);
print_r($a);
?>