Random Fun with Arrays3:36 with Alena Holligan
Using a built in PHP function, we’ll choose four random items to suggest on the home page.
When using array_rand, the resulting array of keys is NOT shuffled, the books will always come before movies, which will come before music. If you want to randomize these even further you could use the shuffle function as well.
$random =array_rand($catalog,4); shuffle($random);
You need to sign up for Treehouse in order to download course files.Sign up