Allora ho corretto l' errore nello script non mi ero accorto di aver assegnato key3 al terzo banner e al quarto banner, cmq il risultato non cambia, ho creato un file che si chiama "rotazione banner.php" con il seguente codice:

Codice PHP:
 <?php 
// dichiarazione del banner 
$banner = array( 
"banner" => array("bomb.gif""frown.gif""grim.gif""smile.gif"), 
"link" => array("http://www.google.com""http://www.myspace.com""http://www.msn.com""http://www.smile.com"), 
); 

// conto quanti banner sono presenti nell'array 
// toglo 1 al totale perché la numerazione 
// degli array parte da 0 (zero) 
$num count($banner) - 1

// genero due numeri casuali, che indicano 
// il valore di ogni chiave nell'array dei banners 
$key1 rand(0$num); 
$key2 rand(0$num); 
// applico la funzione di cui sopra per 
// ottenere una chiave numerica diversa dalla precedente 

while($key1 === $key2) { 
$key2 rand(0$num); 



$primo_banner 
<a href=\"http://www.google.com"
.$banner['link'][$key1]."\"> 
<img src=\"bomb.gif"
.$banner['banner'][$key1]."\" /> 
</a> 
"

$secondo_banner 
<a href=\"http://www.myspace.com"
.$banner['link'][$key2]."\"> 
<img src=\"frown.gif"
.$banner['banner'][$key2]."\" /> 
</a> 
"

$terzo_banner 
<a href=\"http://www.msn.com"
.$banner['link'][$key3]."\"> 
<img src=\"grim.gif"
.$banner['banner'][$key3]."\" /> 
</a> 
"

$quarto_banner 
<a href=\"http://www.smile.com"
.$banner['link'][$key4]."\"> 
<img src=\"smile.gif"
.$banner['banner'][$key4]."\" /> 
</a> 
"

?>
mentre il codice della pagina home.php è il seguente:

codice:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>


echo " 
$primo_banner 

 
$secondo_banner 

 
$terzo_banner 
";





</body>
</html>
tutti i files comprese le immagini si trovano nella stessa cartella.