dachshund Posted June 27, 2009 Share Posted June 27, 2009 Hi, Does anyone know how to set up 2 images which each have a 50% chance of being shown? for example, when advertisements on sites change when you refresh the page. can this be done with php? thanks for any help. Link to comment https://forums.phpfreaks.com/topic/163915-solved-50-chance-of-one-image-being-shown-50-chance-of-the-other-being-shown/ Share on other sites More sharing options...
.josh Posted June 27, 2009 Share Posted June 27, 2009 $array = array('image1.jpg','image2.jpg'); shuffle($array); echo "<img src='{$array[0]}' width = 'xx' height = 'xx' />"; Link to comment https://forums.phpfreaks.com/topic/163915-solved-50-chance-of-one-image-being-shown-50-chance-of-the-other-being-shown/#findComment-864806 Share on other sites More sharing options...
dachshund Posted June 27, 2009 Author Share Posted June 27, 2009 thanks! Link to comment https://forums.phpfreaks.com/topic/163915-solved-50-chance-of-one-image-being-shown-50-chance-of-the-other-being-shown/#findComment-864828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.