如何使用php将格式±DD.DDDD±DDD.DDDD
解析为Geolocation ISO 6709为double [lat,long]?
的示例:
'+18.81983-19.91984'
将为Array ( [0] => +18.81983 [1] => -19.91984 ) )
'-8.8194+29.81982'
将为Array ( [0] => -8.8194 [1] => +29.81982 ) )
'+29.1989+54.01983'
将为Array ( [0] => +29.1989 [1] => +54.01983) )
答案 0 :(得分:0)
试试这个:
preg_match_all('/(\+|\-)(\d+\.?\d+)/', '+18.81983-19.91984', $matches);
echo $matches[0];
让我知道这对你有用。