Shuffle an array in PHP

As $bb is an array of arrays, shuffle() won't randomise the sub-array, try shuffle on the nested array as follows:

shuffle($bb['slides']);

You probably shuffled the outer $bb array, when you should have done:

shuffle($bb['slides']);
foreach($bb['slides'] as $b):

shuffle($array_name); // will shuffle array

http://www.php.net/manual/en/function.shuffle.php

Also the foreach should be

for($array_name as $array_item) {
// do stuff
}