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 - PHP Tutorial
From the course: Learning PHP
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Boolean operators and the truth (update for PHP 8.0)6m 27s
-
(Locked)
Logical operators6m 34s
-
(Locked)
Creating if/else statements8m 5s
-
(Locked)
Ternary operations5m 53s
-
(Locked)
Switch statements7m 8s
-
(Locked)
Match expression8m 4s
-
(Locked)
Challenge: Display content based on status1m
-
(Locked)
Solution: Display content based on status5m 1s
-
-
-
-
-
-
-
-
-