Home / PHP Tips Generated By ChatGPT / Shuffling Array Elements Randomly in PHP Randomize the order of elements in an array using shuffle(). Source Code $cards = [1, 2, 3, 4, 5]; shuffle($cards); print_r($cards); // The order of $cards is now random