我如何过滤此数组值[Name] =>
尝试匹配值名称开头的单词“Good”
Array
(
[0] => Array
(
[Name] => Good Seat
[image] => spot
[category] => 0
)
[1] => Array
(
[Name] => Nice Good Service
[image] => spotless
[category] => 0
)
[2] => Array
(
[Name] => Good Work
[image] => spotly
[category] => 1
)
)
我需要这样的过滤器
Array
(
[0] => Array
(
[Name] => Good Seat
[image] => spot
[category] => 0
)
[1] => Array
(
[Name] => Good Work
[image] => spotly
[category] => 1
)
)
我的代码
function name($var)
{
return (is_array($var) && $var['Name'] == preg_match("/^Good/", $var['Name']));
}
print_r(array_filter($var, "name"));
谢谢。