// This code assumes the fortunes are in a file called // "fortunes.txt". // The line that is commented out is used in the PHP // version but not in the Ajax version, because the front // end issues are dealt with using JavaScript. <?php showFortune(); function showFortune() { $fortunes = file ("fortunes.txt"); $n = count ($fortunes); $random = rand(0, $n-1); $fortune = $fortunes[$random]; // $fortune = str_replace("~", "<br />~", $fortune); echo $fortune; } ?>