Example #1
0
            }
            $counter++;
            echo "\n";
        }
        echo "\n";
    }
    function RegularTriangle()
    {
        for ($x = 0; $x < $this->input + 1; $x++) {
            for ($y = 0; $y < $x + 1; $y++) {
                echo $this->ParentArray[$x][$y];
            }
            echo "\n";
        }
    }
    function UpsideDownTriangle()
    {
        for ($x = 0; $x < $this->input + 1; $x++) {
            for ($y = $this->input; $y > $x - 1; $y--) {
                echo $this->ParentArray[$x][$y];
            }
            echo "\n";
        }
    }
}
$regular = new ShapeMaker(4);
$regular->RegularTriangle();
$backwards = new ShapeMaker(4);
$backwards->BackwardsTriangle();
$upsidedown = new ShapeMaker(4);
$upsidedown->UpsideDownTriangle();