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.
如何从仅包含特殊字符(如 .、* 等)的数组中删除所有元素。
function only_specialchars($string) { if (preg_match("/[a-z0-9]/i", $string)) { return false; } else { return true; } } $filtered = array_filter($array, "only_specialchars"));
像这样的东西?这将过滤所有不包含字符或数字的单词。