//Only replies if there is a question If ($question) { //Chooses a random number $result = Rand (1,8); //Reminds them of their question Echo "Your question: $question
"; //Based on the random number, gives an answer if ($result ==1) { Echo "The 8-ball says: Yes"; } if ($result ==2) { Echo "The 8-ball says: No"; } if ($result ==3) { Echo "The 8-ball says: Ask again later"; } if ($result ==4) { Echo "The 8-ball says: Perhaps, perhaps, perhaps"; } if ($result ==5) { Echo "The 8-ball says: The future is hazy"; } if ($result ==6) { Echo "The 8-ball says: It is certain"; } if ($result ==7) { Echo "The 8-ball says: Without a doubt"; } if ($result ==8) { Echo "The 8-ball says: There is no chance"; } } ?>