<?phpclass Car{var $color;function Car($color="green") {$this->color = $color;}function what_color() {return $this->color;}}function print_vars($obj) {foreach (get_object_vars($obj) as $prop => $val) {echo "$prop = $val";}}// 使用 new 语句实例化一个对象(类)。$herbie = new Car("white");// 输出变量 $herbie 的属性。echo "herbie: Properties<br>";print_vars($herbie);?>·