main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// php
function fizzbuzz($x) {
    for ( $i = 1; $i < $x+1; $i++ ) {
        $div3 = "";
        if ($i % 3 == 0) {
            $div3 = "fizz";
        }
        $div5 = "";
        if ($i % 5 == 0) {
            $div5 = "buzz";
        }
        $n = "";
        if ($div3 == "" && $div5 == "") {
            $n = (string)$i;
        }
        print( $div3 . $div5 . $n . "'\n'" );
    }
}

fizzbuzz(100);
PHP 7.0.8 (cli) (built: Jun 23 2016 23:39:14) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies