Example #1
0
    function upsidedowntriangle()
    {
        $rowLimit1 = 4;
        for ($i = 0; $i < $this->size; $i++) {
            for ($t = 0; $t < $rowLimit1; $t++) {
                echo $this->stars[$i][$t];
            }
            echo "\n";
            $rowLimit1--;
            // changed variable to -- to decrease by 1 *
        }
    }
}
$maker = new ShapeMaker(4);
//print_r ($maker->stars);// using maker var cause outside of class, oppose to using $this which is inside
$maker->backwardstriangle();
$maker->upsidedowntriangle();
$maker->triangle();
//calling the function, creating it is only declaring it
?>