tryphp_datatypes_object.php:
color = $color; $this->model = $model; } public function message() { return "My car is a " . $this->color . " " . $this->model . "!"; } } $myCar = new Car("black", "Volvo"); echo $myCar -> message(); echo "
"; $myCar = new Car("red", "Toyota"); echo $myCar -> message(); ?>
My car is a black Volvo!
My car is a red Toyota!