Hi, I’m just starting with PHP and wish to have a random image on a page. I have tried searching these forums but have been quite confused. I have written what I wish to create in JavaScript so you can see what kind of effect I’m after:
[CODE]<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
<title>New Page 1</title>
</head>
<body>
<Script>
var picPath=new Array(“pic1.jpg”, “pic2.jpg”, “pic3.jpg”)
var picWidth=new Array(120, 220, 175);
var picHeight=new Array(65, 98, 160);
var n=Math.floor(Math.random()*picPath.length);
document.write(‘<img src=’+picPath[n]+’ width=’+picWidth[n]+’ height=’+picHeight[n]+’>’);
</script>
</body>
</html>
Can somebody please rewrite this in PHP, it would be a huge help and would allow me to understand probably the most important features (for me) of PHP.
Thankyou for you time.
-Benjamin