I have the following code:
<?php
foreach($bb['slides'] as $b):
$url = "domain.com/" . $b->image . ";
echo($url);
endforeach;
?>
The output is as follows:
domain.com/image1.jpg
domain.com/image2.jpg
domain.com/image3.jpg
I am trying to randomize the order of the output. Before the foreach statement I tried to shuffle the array using shuffle($bb); but that did not work. Any help is appreciated.
As $bb is an array of arrays, shuffle() won’t randomise the sub-array, try
shuffleon the nested array as follows: