Reputation: 1727
I have an array, some elements are single string, final element is comma seperated string
Array (
[0] => text
[1] => text
[2] => text
[3] => text1, text2, text3
)
I want to join all elements into one comma seperated string. Neither explode nor join could manage this. How can I get a result like this:
array(text, text, text, text1, text2, text3)
Upvotes: 3
Views: 763
Reputation: 16115
$aNew = array(implode(', ', $aTest));
Also see this or this example.
Upvotes: 2
Reputation: 86406
implode it and then explode
$array = explode(',', implode(',', $array));
Upvotes: 2