How to merge strings


Hi all,

since some weeks I learn php combined with HTML and Java Script.
I would like to bring 8 strings together in pairs. I have now searched the manual for hours and unfortunately found nothing.

That is what it looks like (via “view-source”):

    [0] => AB
    [1] => CD,
    [2] => EF
    [3] => GH,
    [4] => IJ
    [5] => KL,
    [6] => MN
    [7] => OP,

and I want it to look like this:

    [0] => AB CD
    [1] => EF GH
    [2] => IJ KL
    [3] => MN OP

Is there a simple way to merge the strings?



How do you end up with the array in the first place?


Hi JimL,

that was my last try to get this done:


I was searching for the most simple way to do this by implode and explode…



Tell us what the real problem is instead of asking how to solve your attempted solution to the problem.


I splitted the strings with my last try:


but I have no idea, how to merge them again in the right way…that’s my problem.



No, this is your attempt at solving the real problem. What is this array all about? What is the overall problem this attempt is supposed to solve?