【php开源代码栏目提醒】:网学会员php开源代码为您提供code3.29.php参考,解决您在code3.29.php学习中工作中的难题,参考学习。
<?php
class ClassName {
public $x, $y;
public $label;
function ClassName ($x, $y)
{
$this->x = $x;
$this->y = $y;
}
function setLabel($label)
{
$this->label = $label;
}
function getPoint()
{
return array("x" => $this->x,
"y" => $this->y,
"label" => $this->label);
}
}
$p = new ClassName(1.233, 3.445);
print_r(get_object_vars($p));
$p->setLabel("point #1");
print_r(get_object_vars($p));
?>