From the course: PHP Practice Challenges
Unlock this course with a free trial
Join today to access over 25,600 courses taught by industry experts.
Write a number guessing game
From the course: PHP Practice Challenges
Write a number guessing game
(bright music) - [Instructor] Over the last few challenges, you've compared numbers, processed forms, and even created a cookie to store data. Now it's time to put it all together by writing a number guessing game. Here are the requirements. The game will generate a random number and store it in a cookie. You should accept input from the user, a single number that will be the guess. A form is provided for this. When a guest is submitted a check guest function will determine if the guess is correct, too low, or too high, then tell the user. If the guest is correct, the cookie should be deleted, the form hidden and the user given the option to guess again. Some important notes. There are a lot of ways to achieve this. So your solution could look very different from mine. And remember that cookies need to be set and deleted before anything else is printed. Allowing the user to guess again can simply just be a link to the page causing the browser to refresh and making it forget the…
Contents
-
-
-
Event capacity: Compare two numbers3m 18s
-
(Locked)
Flip a coin2m 40s
-
(Locked)
High card6m 22s
-
(Locked)
Fizz Buzz3m 53s
-
(Locked)
Given a birth date, determine age3m 54s
-
(Locked)
Determine who's older: Comparing objects4m 13s
-
(Locked)
Sort people by age: Sorting an array of objects5m 35s
-
(Locked)
Extend a class6m 17s
-
Process a simple contact form7m 10s
-
(Locked)
Store and retrieve data from a cookie4m 24s
-
(Locked)
Send an email6m 6s
-
(Locked)
Save to a file7m 44s
-
(Locked)
Create functions in a namespace5m 7s
-
(Locked)
Build a calculator form5m 17s
-
(Locked)
Write a number guessing game10m 19s
-
(Locked)
Generate a form from an array of values20m 10s
-
(Locked)
Retrieve and display data from a provided REST API6m 52s
-
(Locked)
The Dutch National Flag Problem4m 13s
-
(Locked)
Convert CSV to JSON5m 10s
-
(Locked)
Encrypt then decrypt a string6m 32s
-
(Locked)
Write a login form8m 7s
-
(Locked)
Search an HTML page for information on it6m 1s
-
(Locked)
Text processor7m 33s
-
(Locked)
Associated words7m 36s
-