View Full Version : how to shuffle elements in an array?

03-30-2007, 05:51 AM
I have a small doubt.
I have some 20 elements in an array.
I would like to shuffle them and display them.

for example:
$array=array('a', 'b', 'c', ....'r', 's');

I would like to shuffle and display the elements like this.
c, m, a,....e, n

I dont wish to repeat any element.
how can I do it?
Thank you

03-30-2007, 05:56 AM
shuffle() (http://us.php.net/manual/en/function.shuffle.php)

You really should learn to search the manual-- it's an excellent reference.

03-30-2007, 06:26 AM
Thanks fumigator,
From now, I will first search the manual before posting here.
thanks for your quick reply