主页
PHP
PHP 数据类型
tryphp_datatypes_object_var_dump
运行 ❯
×
更改方向
保存代码
更改主题
<?php class Car { public $color; public $model; public function __construct($color, $model) { $this->color = $color; $this->model = $model; } public function message() { return "My car is a " . $this->color . " " . $this->model . "!"; } } $myCar = new Car("red", "Volvo"); var_dump($myCar); ?>
对象(汽车)#1 (2) { ["颜色"]=> 字符串(3) "红色" ["型号"]=> 字符串(5) "沃尔沃" }