foreach data select as key value if isset value pid value pid Filter a

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
foreach($data['select'] as $key=>$value)
{
if(isset($value['pid']) && $value['pid'] != 0)
{
$Filter = array(
'Where'=>array(
'id'=>$value['pid']
)
);
$array = $this->my->hierarchy( 'hierarchy' , $Filter , array() );
$array = array_reverse( $array , true );
$data['select'][$key]['path'] = implode('/', $array ) ;
}
}
}