0

I have an array like

$a = array
     (   
        "Leafs",  
        "Sabres",  
        "Red Wings",  
        "Flyers"
     ); 

that I shuffle shuffle($a);

The resultant array could be:

Array
(
    [0] => Sabres
    [1] => Red Wings
    [2] => Leafs
    [3] => Flyers
)

With the resultant array, I now want to append a sequential number twice starting with 1 to each element in the array such that $a becomes:

Array
(
    [1] => Sabres
    [1] => Red Wings
    [2] => Leafs
    [2] => Flyers
)

The number ends with 2 in this array, but should continue until there are no more elements to number in the array. How can this be done programmatically?

machump
  • 1,207
  • 2
  • 20
  • 41

0 Answers0