以下是一个简单的PHP对象实例教程,我们将通过创建一个名为`Car`的类,并实例化几个`Car`对象来展示如何使用PHP中的对象。
创建Car类
我们需要定义一个`Car`类,它将包含一些属性和方法。

```php
class Car {
public $brand;
public $model;
public $year;
public function __construct($brand, $model, $year) {
$this->brand = $brand;
$this->model = $model;
$this->year = $year;
}
public function displayInfo() {
echo "






