Hello
I have an PHP exercise question like below:
Write a XHTML document to that includes an anchor tag that calls a PHP document. Also write the called PHP document, which returns a randomly chosen greeting from a list of five different greetings. The greetings must be
stored as constant strings in the script. A random number between 0 and 4 can be computed with these lines:
#set the seed for mtrand with the number of microseconds
#since the last full second of the clock
mt_srand ((double) microtime() * 1000000);
$number = mtrand(0, 4 ); #computes a random integer 0-4
Can anyone give me some guidelines in solving this question.
I din't ask for full coding.
I want to try first, so i really need your ideas insolving this question.
Thanks
php(random chosen)
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
It would appear your exercise is from a pretty old reference set. mt_srand() has no longer been needed to be called since PHP 4.2.
As for the meat of your question: An array is the likely intended storage.
As for the meat of your question: An array is the likely intended storage.