//filterArrays($category_result,array(array("col"=>"id","val"=>"49"),array("col"=>"borrow_nid","val"=>"20160500064")));
function filterArrays($list = array(),$where = array()){
$index = 0;
foreach ($list as $key => $value){
$mached = 0;
foreach($where as $wk=>$wv){
//self::log($wv['col']);
//self::log($wv['val']);
if($value[$wv['col']] == $wv['val']){
$mached++;
}
}
if($mached==count($where)){
$data['row'] = $value;
$data['index'] = $index;
return $data;
}
/*
foreach ($value as $_key => $_value){
if($_key==$where['col'] && $_value==$where['val']){
$data['row'] = $value;
$data['index'] = $index;
return $data;
}
}
*/
$index++;
}
$data['row'] = null;
$data['index'] = -1;
return $data;
}