Created
September 2, 2011 14:23
-
-
Save mbernson/1188723 to your computer and use it in GitHub Desktop.
Kaasschaaf
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 | |
/* | |
* Count from 1 to 100, | |
* for every multiple of 3, echo "Kaas" | |
* for every multiple of 5, echo "Schaaf" | |
*/ | |
function kaasschaaf() | |
{ | |
$output = ''; | |
for($c = 1; $c <= 100; $c++) | |
{ | |
$output .= $c.' '; | |
if(is_int($c / 3)) | |
$output .= 'Kaas'; | |
if(is_int($c / 5)) | |
$output .= 'Schaaf'; | |
$output .= "\n"; | |
} | |
return $output; | |
} | |
echo '<pre>'.kaasschaaf().'</pre>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Kaas