LoginSignup
1
0

More than 5 years have passed since last update.

is_intを使ってFizzBuzz

Last updated at Posted at 2017-06-11
code.php
<?php
for ($i=1; $i < 101; $i++) {
  $b=true;
  if (is_int($i/3)) {
    echo "Fizz";
    $b = false;
  }
  if (is_int($i/5)) {
    echo "Buzz";
    $b = false;
  }
  if ($b) {
    echo $i;
  }
  echo "<br>";
}

is_intを使った方法がどこにもなかったので。

if ($i % 3 == 0) {
if (is_int($i/3)) {

文字数はそんなに変わらない。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0