Object-oriented in PHP with database+Framework(Codeigniter)

Course Content

Total learning: 86 lessons

Constructor

in PHP/PHP5 we have a concept of the constructor so in this video, you gonna learn can you create the constructor in PHP.

class Car{
    function __construct($carName,$carColor,$carPrice)
    {
        $this->carName = $carName ;
        $this->carColor = $carColor ;
        $this->carPrice = $carPrice ;
    }


    public $carName;
    public $carPrice;
    public $carColor;
    public static $myStaticProperty = 'shakzee.com';
   

    private function myFunction(){
        echo 'Private function';
    }
    public function display(){
        echo $this->carName.'<br>';
        echo $this->carColor.'<br>';
        echo $this->carPrice.'<br>';
        //echo $this->myProperty;
        //echo $this->myPrivate;
        $this->myFunction();
    }
    public function test($para){
        echo $para . ' method ';
    }
    public static function myStatic(){
        echo 'my static method';
    }
}//class

 

Featured Courses

Learn Web Development and web designing in few months from shakzee with real-world experience. Get up to 80% discount!