Random output?
| From: | ScreamKing | Date: | Thu, 28 Dec 2000 00:18:29 +0000 |
| Subject: | Random output? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-32024@lists.php.net to get a copy of this message | ||
Hi All,
I need a little help with an output problem. I want to output a message (see below) but would like
to use more than one variation of the same statement, as the message will become too repetitive. Is
there a way I can randomly choose a message for the same if expression?
At the moment, there is only one variation for the below, but I would love to increase that to
randomly chosen ones.
Any help is much appreciated.
echo "<br><b>PLAYER STATUS</b><br>";
if ($wage == "$current_wage") {
echo "Despite being delighted at signing for $club_name, $player_name expressed his
disappointment at not securing a higher wage.<BR>\n";
} elseif ($wage > "$current_wage") {
echo "$player_name has stated that he is delighted with the pay-rise given to him in his new
contract.<BR>\n";
} elseif ($wage < "$current_wage") {
echo "$player_name has admitted that while he is disappointed by the wage offer, he is still
looking forward to playing for $club_name.<BR>\n";
} else {
echo "$player_name has stated the his contract details have satisfied his personal
needs."<BR>\n";
}
Cheers,
SK