开发者

PHP regex - get latitude and longitude

开发者 https://www.devze.com 2023-03-27 09:57 出处:网络
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)

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

精彩评论

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

关注公众号