下面是一个多维数组;我试图通过使用代码(如下所述)过滤掉“级别”值等于4的所有子数组内容的列表;有人可以指导我如何通过将两个或多个条件应用于同一代码来获得相同的列表。
前任roleid =3 && level = 4 && queryid=59
//array as follows
$Row_Hedder =
Array
(
[1] => Array
(
[username] => Suman
[roleid] => 3
[password] => drf123
[level] => 3
[queryid] => 59
[year] => 2013
[month] => 1
[date] => 1
[pagezone11] => 1
[visiblename] => Suman
[em1] =>
[em2] =>
)
[2] => Array
(
[username] => Pranav
[roleid] => 3
[password] => drf123
[level] => 3
[queryid] => 59
[year] => 2013
[month] => 1
[date] => 1
[pagezone11] => 2
[visiblename] => Pranav
[em1] =>
[em2] =>
)
用于过滤的代码如下所述,
$filter_val1 = 4;
$filter = function($player) use($filter_val1) { return ($player['level'] == $filter_val1); };
$filtered = array_filter($Row_Hedder, $filter);