我想删除包含等级0的数组索引这里是我的数组 p>
array(
(int)0 => array(
'Gig'=> array(
'id'=>'1',
'rating'=>(int) 5
)
),
(int)1 =>数组(
'Gig'=>数组(
'id'=>'3',
'rating'=>( int)9
)
),
(int)2 =>数组(
'Gig'=>数组(
'id'=>'4',
'rating'=> ;'0'
)
)
)
code> pre>
我做了什么 p>
for( $ i = 0; $ i< count($ agetGigsItem); $ i ++)
{
if($ agetGigsItem [$ i] ['Gig'] ['rating'] == 0)
{
unset($ agetGigsItem [$ I]);
}
$ this-> set('agetGigsItem',$ agetGigsItem);
}
code> pre>
我也尝试使用foreach循环但无法解决此问题 问题。 p>
foreach($ agetGigsItem as $ key => $ value){
if($ value [“Gig”] [“rating”] == 0){unset($ agetGigsItem [$ key]); }
}
code> pre>
div>