aergaerhaer
Новичок
PHP:
class Exam1
{
private $id;
public function __construct()
{
$this->id = 5;
}
public function getObj()
{
$dd = new Exam1();
$dd->id = 54;
return $dd;
}
public function getId()
{
return $this->id;
}
}
$d = new Exam1();
echo $d->getId();
echo '<br/>';
echo $d->getObj()->getId();
результат:
5
54