, $this, . :
<?php
class Person
{
private $strName;
private $strSurname;
private $ArrPhone = array();
public function name($strName)
{
$this->strName = $strName;
return $this;
}
public function surname($strSurname)
{
$this->strSurname = $strSurname;
return $this;
}
public function phone()
{ $this->ArrPhone = func_get_args();
return $this;
}
public function __toString()
{
return $this->strName." ".$this->strSurname.", ".implode(" ",$this->ArrPhone);
}
}
$me = new Person;
echo $me->name("Franky")->surname("Chanyau")->phone("+22", "456 789");
?>