php(random chosen)
Posted: Tue Jan 09, 2007 4:01 am
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
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