$images = array("img1.jpg", "img2.png", "img3.jpg"); $random = rand(0,2); echo "<img class=\"css_class\" src=\"".$images[$random]."\" />";