Multiple array in php


If the ID, topic and description are all in the correct order in each comma delimited string you are supplying to the script, you could use the following to create a single array key'd by the ID:


$id = explode(',',$data->id);
$topic = explode(',',$data->topic);
$description = explode(',',$data->description);

foreach($id as $key=>$val)
{
    $results[$val]['topic'] = $topic[$key];
    $results[$val]['description'] = $description[$key];
}



$newArray=array_merge($topic,$description,$third_array);
foreach($newArray as $key=>$value)
{
echo "$key- $value <br/>";
}