$ar
=
array
(
2 =>
array
(
'catid'
=> 2,
'catdir'
=>
'notice'
,
),
5 =>
array
(
'catid'
=> 5,
'catdir'
=>
'subject'
,
),
6=>
array
(
'catid'
=> 6,
'catdir'
=>
'news'
),
);
$catid
= 5;
$r
=
array_filter
(
$ar
,
function
(
$t
)
use
(
$catid
) {
return
$t
[
'catid'
] ==
$catid
; });
print_r(
$r
);
http://bbs.csdn.net/topics/390957435