THAPA TECHNICAL

HOUSE OF WEB DEVELOPERS AND TECHNOLOGY.

PHP challenge HEADS, I WIN! TAILS YOU WIN!

HEADS, I WIN! 

This challenge tests your understanding of the RAND() function and IF­ELSE statement. 

You need to generate a random number between 1 and 2. 

If the random number is 1 then echo “Heads, I win!”   
If the random number is 2 then echo “Tails, you win!”     

EXTENSION   

This extension challenge tests your understanding of:   
● RAND()
● IF­ELSE
● FOR loop
● concatenation   

Use a loop to generate the above 100 times. 

Keep a score of how many heads there were and how many tails and then echo out the results as

There were 48 heads and 52 tails.  

3 comments: