PHP Modify Array

Posted by Ozzy on Stack Overflow See other posts from Stack Overflow or by Ozzy
Published on 2011-01-02T05:19:29Z Indexed on 2011/01/02 9:53 UTC
Read the original article Hit count: 254

Filed under:
|
|
|

Hi all, I have the following array:

array(a, a, a, b, b, c, c, c, c, d, d);

When I loop through it and echo it, the result is:

a
a
a
b
b
c
c
c
c
d
d

How ever I want to echo it in such a way that it displays:

a
b
c
d
a
b
c
d
a
c
c

Here is the array in a grid to better explain what im trying to achieve

Current
a a a b
b c c c
c d d

What im tryin to do
a b c d
a b c d
a c c

How would I do this?

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays