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 =
$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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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);
?>
<?
$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);
?>
ASKER