Untitled

 avatar
unknown
plain_text
3 years ago
1.1 kB
3
Indexable
<?php

class Button
{
    private $height;
    private $width;
    private $fontSize;
    private $backGroundColor;
    private $color;
    private $btnTitle;
    private static $className = 0;

    function __construct($height, $width, $fontSize, $backGroundColor, $color, $btnTitle)
    {
        $this->height = $height;
        $this->width = $width;
        $this->fontSize = $fontSize;
        $this->backGroundColor = $backGroundColor;
        $this->color = $color;
        $this->btnTitle = $btnTitle;
        self::$className += 1;
    }

    public function printbutton()
    {
        return '<button class="btn' . self::$className . '"
        style="' . "height:$this->height;width:$this->width;font-size:$this->fontSize;background-color:$this->backGroundColor;color:$this->color;" . '">' . $this->btnTitle . '</button>';
    }
}

// $a = new Button("40px", "40px", "15px", "red", "green", "aaa");
// echo $a->printbutton();
// $b = new Button("", "", "", "", "", "bbb");
// echo $b->printbutton();
// $c = new Button('', '', "40px", "cyan", "#f6a200", "ccc");
// echo $c->printbutton();
Editor is loading...