My question is the following:
If you look below you\'ll see there is a datastructure with message ids and then the final datastructure containing the message detail
I don't have access to PHP right now, to test, but I believe what you're trying to do is something like
foreach($emails as $email) {
foreach($threads as $root => $messages) {
foreach($messages as $index =>$message_id){
if($message_id == $email->msgno){
$threads[$root][$index] = $email;
}
}
}
}
That being said, even if this works, there is probably a more efficient way to approach this than with three nested loops. What is your reason for needing to store the output in this format?