I am using return array function to return multiple query results in PHP. The function I used is: $main_ar=return array($query_result1,$query_result2). It is giving me two arrays at once like below:
Array ( [word_id] => 3 [main_word] => happy [n1] => Jason [v1] => plays [n2] => football )
Array ( [word_id] => 4 [main_word] => dog [n1] => Carter [v1] => plays [n2] => fetch_ball )
Now I want to combine these two array so that n1 index of first array can be printed with other indexes of second array. As a result I can get Jason dog Jason Carter Jason plays Jason fetch_ball etc. But using foreach loop is not helping me in here. It is giving 2 index values at the same time:
foreach ($main_ar as $value) {
foreach ($value as $last) {
echo $last['n1'];
}
}
Output is: JasnCarter.
What's the possible solution?