How to compare a array with another array stdclassobject and access it key in php codeigniter -
i using php codeigniter. when did print_r
, got following:
array ( [0] => stdclass object ( [username] => fun [usercode] => 6 [groupcode] => 1 [groupname] => master [menucode] => 0 [menuname] => [admin] => 0 ) [1] => stdclass object ( [username] => fun [usercode] => 6 [groupcode] => 1 [groupname] => master [menucode] => 1 [menuname] => item master [admin] => 0 ) )
in hands have set of array,
array ( [0] => billing report [1] => waiterwise report [2] => admin [3] => user master [4] => user rights [5] => close session [6] => close day )
now want compare group name in above 2 array , want key result.
try
$result_array = array(); foreach($codeigniter_array $k=>$r) { foreach($r $k1=>$r1) { if(in_array($r1, $group_array)) { $result_array[$k1] =$r1; } } } print_r($result_array);die;
Comments
Post a Comment