my code causes the images to appear randomly within the page. But how to insert an \"element\" (in my case would be a div) between these images?
You would want something like this...
$myImagesList = array (
'image1.png',
'image2.png',
'image3.png',
'image4.png'
);
shuffle ($myImagesList);
$i = 0;
foreach ($myImagesList as $img) {
$i++;
if ($i % 3 === 0) { /* show content */ }
echo '
';
}
This will give you the content section every third iteration, no matter the size of the list.