Rumah >pembangunan bahagian belakang >tutorial php > php根据条件排除,该如何解决
php根据条件排除
$a = "'你好(39)','你好啊(60)','他好(52)','他好啊(23)','我好(80)','我好啊(99)'";
$a = "'你好(39)','你好啊(60)','他好(52)','他好啊(23)','我好(80)','我好啊(99)'";
$arr = explode('\',\'', trim($a, '\''));
$newArr = array();
foreach ($arr as &$value) {
if (preg_match('/[\d]+/', $value, $match)) {
if (isset($match[0])) {
if ($match[0] > 50) {
$newArr[] = '\''.$value.'\'';
}
}
}
}
echo '"'.implode(',',$newArr).'"';