Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我有一些这样的输入:
$string = "0°25'30"S, 91°7'W"
我想在 php 中制定一个正则表达式来捕获各个元素,以便我最终得到:
$position_array = array([0] => 0 [1] => 25 [2] => 30 [3] => S [4] => 91 [0] => 7 [0] => W)
任何帮助将非常感激。
在我的头顶上,我会试试这个:
$array = array_filter(preg_split("/[^A-Za-z0-9]/",$string), function ($segment) { return strlen(trim($segment)); });