From the course: PHP Practice Challenges
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Fizz Buzz
(electronic music) - [Instructor] Some problems are purely academic but get you to think a certain way. And this example, on top of being purely academic, is a favorite for job interviews. FizzBuzz is a classic problem that has you print all numbers from 1 to 100, inclusive, while making important substitutions. Here are the requirements: Replace all multiples of 3 with the word Fizz, replace all multiples of 5 with the word Buzz, and replace any numbers that are multiples of 3 and 5 with the word FizzBuzz. There are a lot of different ways to implement this solution, so definitely work through one that feels right for you. And there's no starter file for this, you'll be starting completely from scratch. Go ahead and pause this video here to write your own, then we'll look at the solution I came up with. (electronic music) Welcome back! Let's get to solving this classic problem. I'll open up my php tags and the first thing I'll do is write our incrementor, $i = 1; Then we'll work…
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
-