Shuffling an Array in PHP


Randomize the order of elements in an array with shuffle().

Source Code

$cards = range(1, 10);
shuffle($cards);
print_r($cards); // Outputs the elements in a random order
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments