Codice PHP:
<?php
$fn 
"messaggi.txt";
$righe=file($fn);
$k array_rand($righe);
echo 
$righe[$k];
?>
andava bene prima... array_rand senza secondo argomento restituisce un indice posizionale (o chiave), diversamente restituisce un array di chiavi.