php - How to work with integrate 2 different array? -
i working 2 different array want integrate both of become result want. have no idea how it.
this array return current result me :
foreach($getvote $option){ $data['id'] = $option['option_id']; $data['option'] = $option['option']; }
and result :
array ( [id] => array ( [0] => 1 [1] => 2 ) [option] => array ( [0] => option 1 id 2 [1] => option 2 id 2 ) )
but want :
array ([0]=>array( [id] => 1 [option] => option 1 id 2) [1]=>array( [id] => 2 [option]=> option 2 id 2 ) )
this $getvote
result :
array ([0] => array ( [id] => 2 [option_id] => array ( [0] => 1 [1] => 2 ) [option] => array ( [0] => option 1 id 2 [1] => option 2 id 2 ) [subject] => test 2 [type] => 1 ) )
i don't know asking correct question. hope can all. in advanced.
try
for($i =0; $i<count($getvote[0]['option_id']); $i++) { $data[$i]['id'] = $getvote[0]['option_id'][$i]; $data[$i]['option'] = $getvote[0]['option'][$i]; }
output :-
array ( [0] => array ( [id] => 1 [option] => option 1 id 2 ) [1] => array ( [id] => 2 [option] => option 2 id 2 ) )
Comments
Post a Comment