Exercise Weekend

The Ping-Pong test is a programming test that makes sure you understand how to use loops, conditionals, and variables. The challenge is to simply make a `pingPong` function that returns a numerically indexed array of all the numbers from `0` up to the number it was called on. But, for multiples of three, the array contains the string `"ping"` instead of the number, and for multiples of five, the array contains `"pong"`. For numbers that are multiples of three and five, the array contains `"ping-pong"`. 0 should remain 0. Remember that arrays are allowed to include both strings and numbers.

In other words:

``````> \$returned_array = pingPong(18);
> var_dump(\$returned_array);
array(19) {
=>
int(0)
=>
int(1)
=>
int(2)
=>
string(4) "ping"
=>
int(4)
=>
string(4) "pong"
=>
string(4) "ping"
=>
int(7)
=>
int(8)
=>
string(4) "ping"
=>
string(4) "pong"
=>
int(11)
=>
string(4) "ping"
=>
int(13)
=>
int(14)
=>
string(9) "ping-pong"
=>
int(16)
=>
int(17)
=>
string(4) "ping"
}
``````

Take the test and write the function! Write it out in a text file first so that you can edit it and make sure your formatting is correct. Be thorough: watch those curly brackets and indent your code. Then paste it into the PHP shell to test it.

Here is a hint: To tell if one number is divisible by another number, use the `%` operator, which is called modulo. Modulo gives you the remainder if you divide the number on the left by the number on the right. Try it out in the PHP shell.

``````> echo 14 % 7;
0
> echo 14 % 4;
2
``````

`14 % 7` evaluates to `0` because there's no remainder, and `14 % 4` evaluates to `2` because 14 / 4 is equal to 3 with a remainder of 2. Since anything non-zero is truthy and 0 is falsy, you can use the modulo in the condition of an `if` statement.