布尔类型
true ---真
false---假
get_object_vars()
//get_object_vars($obj) 获得对象类型: array 数组
// foreach (get_object_vars($obj) as $prop => $val) 以键值对的方式输出数组
<?php
class Car
{
var $color;
function Car($color="green",$price=123) {
$this->color = $color;
$this->price = price;
}
function what_color() {
return $this->color;
}
var $price;
}function print_vars($obj) {
foreach (get_object_vars($obj) as $prop => $val) {
echo "\t$prop = $val\n";
}
}// instantiate one object
$herbie = new Car("white",12345);// show herbie properties
echo "\herbie: Properties\n";
print_vars($herbie);?>