Multiple array in php -
i wanted combine 3 arrays inside foreach,
$topic = explode(',',$data->topic); $description = explode(',',$data->description); foreach (array_combine($topic, $description) $topic => $description) { echo $topic; echo $description; }
which working 2 arrays, want 3 arrays, because want pass $id = explode(',',$data->id);
in same array not possible using array_combine, can passing 3 arrays inside same foreach?
if id, topic , description in correct order in each comma delimited string supplying script, use following create single array key'd id:
$id = explode(',',$data->id); $topic = explode(',',$data->topic); $description = explode(',',$data->description); foreach($id $key=>$val) { $results[$val]['topic'] = $topic[$key]; $results[$val]['description'] = $description[$key]; }
Comments
Post a Comment