Created
September 4, 2017 19:42
-
-
Save joduplessis/4a7d0d9f682a3b216c1bb2c6a1efe048 to your computer and use it in GitHub Desktop.
The very famous sequenced printout test people like to ask for when interviewing junior devs.
This file contains 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 | |
for ( $x=1 ; $x<=100 ; $x++ ) { | |
if ( ( fmod($x,3) == 0 ) && ( fmod($x,7) == 0 ) ) { | |
echo "<span style='color:#ff0000'>Both</span><br/>" ; | |
} else if ( fmod($x,3) == 0 ) { | |
echo "<span style='color:#00ff00'>Three</span><br/>" ; | |
} else if ( fmod($x,7) == 0 ) { | |
echo "<span style='color:#0000ff'>Seven</span><br/>" ; | |
} else { | |
echo $x . "<br/>" ; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment