I have this array
[0] => Array
(
[0] => My name
[1] => is
[2] => John
)
[1] => Array
(
[0] => My name is Jane
)
how to achieve this kind of output see below. If the array count is greater than one I want to combine them as one.
[0] => Array
(
[0] => My name is John
)
[1] => Array
(
[0] => My name is Jane
)
here is my code but it didn't work
foreach ($myArr as $key => $value) {
if (count($myArr[$key]) > 1) {
foreach ($value as $k => $v) {
$myArr[$key] .= $v;
}
}
}
thanks
Notice: Array to string conversion$myArr[$key]is still a reference to the inner array.