当前位置: 动力学知识库 > 问答 > 编程问答 >

php - I have a MD Array, which I need to run a function on to return a result where if $res=1 i have to print $spec or else not

问题描述:

db=array();

for($i=1;$i<=n;$i++){

$db[]=array(

'spec'=>$spec,

'res'=>$res

);

}

Array, which I need to run a function on to return a result where if

$res=1 i have to print $spec or else not

网友答案:
foreach($db as $item) 
{
if($item['res']==1) echo $item['spec'];
}
分享给朋友:
您可能感兴趣的文章:
随机阅读: