So, I need to display 2 or 3 different images in a website, as simple parallax dividers for content.
I have an array of 4 images, so I\'ll be able to randomize without r
Not sure is that you want but this will give you randomized images (without repeat) on a page, every time different ones:
';
}
?>
If you want to receive one image per call, one of the possible solutions is to use session:
image.php:
$val) {
if (!is_array($_SESSION['img'])) {
return $val;
} elseif (count($_SESSION['img']) >= count($img)) {
$_SESSION['img'] = array();
}
if (is_array($_SESSION['img']) && !in_array($val, $_SESSION['img'])) {
return $val;
}
}
}
?>
page.php:
';
}
?>
All displayed images are stored into SESSION variable. When all images are displayed, this SESSION var is reset and will start a new cycle.