Object
An object is an instance of a class. Objects of the same class have similar attributes and methods. Objects are instantiated with new keyword.
xxxxxxxxxx25
<?php class Car{ public $color; public $doors; public $model; function __construct($color,$doors,$model){ $this ->color = $color; $this ->doors = $doors; $this ->model = $model; } function get_color(){ return $this->color; }} $red_car = new Car("Red",4,"2021"); //Output: Redecho $red_car->get_color();?>OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment


