From the course: Learning PHP

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Solution: Display content based on status

Solution: Display content based on status - PHP Tutorial

From the course: Learning PHP

Start my 1-month free trial

Solution: Display content based on status

(upbeat music) - [Instructor] All right. Time for the solution. So, just to recap, you were to take the starter file, make a number guessing game out of it where if the guess was correct, you would let the user know. If the guess incorrect, you would tell them if it was too high or too low. And as a bonus, you would also check to see if the guessed number was out of range. And you were provided with two ways to assign num to a value. Just a static way, which was manually assign one, or use the random function built into PHP. Now, I included both so that you could easily test your code with a number where you knew the guessed value so you could create test cases based on that, and then when you were confident, you could uncomment this line and use the random value. So, let's get started using the static number 16. So, first, we want to see if the guess is out of range, so we'll say if guess is less than min or guess is…

Contents