Hmm... it'll take a couple steps:
<?php
$example = array('apple,pear','banana,melon');
$example2 = array('chair,table','sofa,bench');
// first we'll make a temporary array of each individual item:
$temp1 = array();
$temp2 = array();
foreach($example AS $item)
{
list($n,$k) = explode(",", $item);
$temp1[] = $n;
$temp1[] = $k;
}
foreach($example2 AS $item)
{
list($n, $k) = explode(",", $item);
$temp2[] = $n;
$temp2[] = $k;
}
// Debugging:
echo '<pre>';
print_r($temp1);
print_r($temp2);
echo '</pre><hr>';
// Now we merge them ;)
$newArray = array_merge($temp1, $temp2);
// Double check it:
echo '<pre>';
print_r($newArray);
echo '</pre>';
?>
That gives you this output:
Array
(
[0] => apple
[1] => pear
[2] => banana
[3] => melon
)
Array
(
[0] => chair
[1] => table
[2] => sofa
[3] => bench
)
--------------------------------------
Array
(
[0] => apple
[1] => pear
[2] => banana
[3] => melon
[4] => chair
[5] => table
[6] => sofa
[7] => bench
)
Edit
Damn it... just a few seconds too slow.