我得到了这个多个数组$files[],它由键和值组成,如下所示:
[0] => Array
(
[name] => index1.php
[path] => http://localhost/php/gettingstarted/
[number] => 1
)
[1] => Array
(
[name] => index10.php
[path] => http://localhost/php/gettingstarted/
[number] => 2
)
[2] => Array
(
[name] => index11.php
[path] => http://localhost/php/gettingstarted/
[number] => 3
)
Run Code Online (Sandbox Code Playgroud)
我使用此代码创建一个仅由'name'键组成的新数组.但它失败了
array_filter($files, "is_inarr_key('name')");
function is_inarr_key($array, $key)
{
//TODO : remove every array except those who got the same $key
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
array_filter()[function.array滤波器]:第二个参数, 'is_inarr_key(' 姓名 ')',应该在C有效的回调:\ XAMPP\htdocs中\ PHP\gettingstarted \第15行的index.php
所以我的问题是:
array_filter接收参数上进行回调功能?