This is a classic test, but I would like you to think about it in a different, object-oriented way.
Write a program that prints the numbers from 1 to 100:
- For multiples of 3 print "Fizz" instead of the number
- For multiples of 5 print "Buzz".
- For numbers which are multiples of both 3 and 5 print "FizzBuzz".
I would like you to write a Class for this task.
<?php
// Variables
class FizzBuzz
{
// Your code here
}The expected result is:
1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
... etc.