Created
September 8, 2017 00:17
-
-
Save ruslanashaari/563bc0131bd4ed2bde43e8177cfefd41 to your computer and use it in GitHub Desktop.
Convert a number to a string, the contents of which depend on the number's factors. #exercism
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function raindrops($drops) { | |
$output = ''; | |
if ($drops%3 == 0) { | |
$output .= "Pling"; | |
} | |
if ($drops%5 == 0) { | |
$output .= "Plang"; | |
} | |
if ($drops%7 == 0) { | |
$output .= "Plong"; | |
} | |
return (empty($output) ? "$drops" : $output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment