Skip to content

Instantly share code, notes, and snippets.

@Slauta
Created September 16, 2021 08:44
Show Gist options
  • Save Slauta/482c46999e544aeb3da2b895fe172dfc to your computer and use it in GitHub Desktop.
Save Slauta/482c46999e544aeb3da2b895fe172dfc to your computer and use it in GitHub Desktop.
FizzBuzz примеры использования на PHP
<?php
$start = 1;
$end = 100;
for ($number = $start; $number < $end + 1; $number++) {;
echo (implode('', array_map(function ($str, $delimeter) use ($number) {
return !($number % $delimeter) ? $str : '';
}, ['fizz', 'buzz'], [3, 5])) ?: $number) . "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment