php shuffle() returns one item

Posted by mike on Stack Overflow See other posts from Stack Overflow or by mike
Published on 2010-04-08T20:24:23Z Indexed on 2010/04/08 20:33 UTC
Read the original article Hit count: 262

Filed under:

Anyone have any idea why shuffle() would only return 1 item?

when using:

$array2 = shuffle($array1);

with the following array($array1):

Array
(
    [0] => 1
    [1] => 5
    [2] => 6
    [3] => 7
    [4] => 8
    [5] => 10
    [6] => 11
    [7] => 12
    [8] => 13
    [9] => 14
)

The output of:

print_r($array2);

is simply: 1

Any idea as to why it would not only not shuffle the array, but knock off the remaining 9 items in the array?

thanks!

© Stack Overflow or respective owner

Related posts about php