<?php
class Work{
var $name = 'name';
function getName(){
return $this->name;
}
}
class Worker{
var $name = 'Ivan';
var $work = null;
function Worker($work){
$this->work = $work;
}
function getWork(){
return $this->work;
}
}
$microsoft = new Work();
$ivan = new Worker($microsoft);
echo $ivan->getWork()->getName();
?>
PD9waHAKY2xhc3MgV29ya3sKCXZhciAkbmFtZSA9ICduYW1lJzsKCWZ1bmN0aW9uIGdldE5hbWUoKXsKCQlyZXR1cm4gJHRoaXMtPm5hbWU7Cgl9Cn0KY2xhc3MgV29ya2VyewoJdmFyICRuYW1lID0gJ0l2YW4nOwoJdmFyICR3b3JrID0gbnVsbDsKCWZ1bmN0aW9uIFdvcmtlcigkd29yayl7CgkJJHRoaXMtPndvcmsgPSAkd29yazsKCX0KCWZ1bmN0aW9uIGdldFdvcmsoKXsKCQlyZXR1cm4gJHRoaXMtPndvcms7Cgl9Cn0KJG1pY3Jvc29mdCA9IG5ldyBXb3JrKCk7CiRpdmFuID0gbmV3IFdvcmtlcigkbWljcm9zb2Z0KTsKCmVjaG8gJGl2YW4tPmdldFdvcmsoKS0+Z2V0TmFtZSgpOwo/Pg==