You don't need PHP for that, JavaScript is sufficient:
<html>
<head>
<script language = "JavaScript">
<!--
function choose () {
if (document.images) {
var z = Math.floor(Math.random()*2);
switch (z)
{
case 0:
document["myimg"].src = "pics/pic0.jpg";
break;
case 1:
document["myimg"].src = "pics/pic1.jpg";
break;
}
}
}
-->
</script>
<body onload="choose()">
<img name="myimg" src="pics/nopic.jpg">
</body>
</html>
pics/pic0.jpg and pics/pic1.jpg are your ads, and pics/nopic.jpg can be a placeholder (e.g., a white pixel picture). When the page is loaded, the placeholder is replaced by a random picture (adjust the Math.random()*2 and add new switch clauses if you want more than 2 pictures). Sorry for the lack of indentation, I was too lazy.