From the course: Learning PHP
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Display content based on status - PHP Tutorial
From the course: Learning PHP
Challenge: Display content based on status
(bright music) - [Instructor] It's time for another challenge. Imagine you're presented with a randomly generated number between one and 50, and you have a guess. Create a way to give feedback to users such that if they guess correctly, you tell them. If they guess incorrectly, you tell them if they were too high or too low. And as a bonus, also check to see if the guessed number is out of range, that is less than one or more than 50. In the exercise files, you'll be given this starter that has a few variables for you. Min, max, guess, and num. You can change guess and num to whatever you'd like, or if you really want to go nuts, you can use the commented outline which assigns a random value to num within the range between min and max.
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
-
-
-
-
-
-
-
-
-