Sublime Text
<?php class Mobile{ public $model; public $color; public $price; function __construct($input_model, $input_color, $input_price){ $this->model = $input_model; $this->color = $input_color; $this->price = $input_price; } function get_model(){ return $this->model; } function get_color(){ return $this->color; } function get_price(){ return $this->price; } } $nokia = new Mobile('Nokia 8.1','Black','5.000.000'); echo "Model: " . $nokia->model . "<br>"; echo "Màu sắc: " . $nokia->color . "<br>"; echo "Giá tiền: " . $nokia->price; ?>
Model: Nokia 8.1
Màu sắc: Black
Giá tiền: 5.000.000