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.
$grep=preg_grep("/^(\d+)?\.\d+$/", "11.11"); print_r($grep);
这不应该打印一个由“11.11”组成的数组吗?
不...您想使用preg_match...preg_grep用于数组:
preg_match
preg_grep
if(preg_match("/^(\d+)?\.\d+$/", "11.11", $matches)) { print_r($matches); } else { echo "No Match!"; }