php 数组模糊匹配:
$list = array(); // 匹配后的结果 $arr = array("abcd","abef","efgh"); $search_str = "ab"; // 搜索的字符串 foreach($arr as $key=>$val ){ if (strstr( $val , $search_str ) !== false ){ array_push($list, $val); } } $list 即为模糊匹配后的结果: $list = array("abcd","abef");
时间: 2024-10-29 14:37:15