开发者

PHP regex - get latitude and longitude

I wanna get from a page 2 values - lat and long. The source code contains this piece of JS:

new GLatLng(53.299671, -6.267786)

Can anyone suggest me th开发者_开发技巧e best method/regex?


<?php 
$input = "new GLatLng(53.299671, -6.267786)"; 
preg_match("~GLatLng\(([0-9\.\-]+).*?([\.\-0-9]+)\)~i", $input, $match); 

echo $match[1]." and ".$match[2];


Something like this should work:

preg_match("/\(([\d-.]*), ([\d-.]*)\)/",$subject,$matches); 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜