Jawaban:
class Car {
public $make;
public $model;
public $color;
function __construct($make, $model, $color) {
$this->make = $make;
$this->model = $model;
$this->color = $color;
}
function getCarDetails() {
return "This car is a " . $this->color . " " . $this->make . " " . $this->model . ".";
$myCar = new Car("Toyota", "Camry", "red");
echo $myCar->getCarDetails();
" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.
Verified answer
Jawaban:
class Car {
public $make;
public $model;
public $color;
function __construct($make, $model, $color) {
$this->make = $make;
$this->model = $model;
$this->color = $color;
}
function getCarDetails() {
return "This car is a " . $this->color . " " . $this->make . " " . $this->model . ".";
}
}
$myCar = new Car("Toyota", "Camry", "red");
echo $myCar->getCarDetails();