PHP: Reformatting Array -
help me reformat array this:
array ( [samplearr] => array ( [0] => array ( [id] => 1 ) [1] => array ( [id] => 2 ) ) )
this array need reformat in above array:
array ( [samplearr] => array ( [id] => 1 [id2] => 2 ) )
may can looping again array this.
$data['samplearr'] = []; foreach($data['samplearr'] $key => $value) { $k = !empty($key) ? $key : ""; $format['samplearr'][$value['id'].$k] = $value['id']; }
Comments
Post a Comment