Skip to content

Instantly share code, notes, and snippets.

@kane-thornwyrd
Created April 6, 2012 11:12
Show Gist options
  • Save kane-thornwyrd/2318935 to your computer and use it in GitHub Desktop.
Save kane-thornwyrd/2318935 to your computer and use it in GitHub Desktop.
Juste un exemple de FizzFuzz
<?php
$array = range(0, 100);
print_r($array);
function fizzfuzz(array $array){
foreach ($array as $key => $value){
$array[$key] = '';
if(!($value%3)){
$array[$key] .= 'Fizz';
}
if(!($value%5)){
$array[$key] .= 'Fuzz';
}
}
return $array;
}
echo PHP_EOL.PHP_EOL.'=================================================='.PHP_EOL.PHP_EOL;
$fizzfuzz_array = fizzfuzz($array);
print_r($fizzfuzz_array);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment