fork(2) download
  1. <?php
  2. class Work{
  3. var $name = 'name';
  4. function getName(){
  5. return $this->name;
  6. }
  7. }
  8. class Worker{
  9. var $name = 'Ivan';
  10. var $work = null;
  11. function Worker($work){
  12. $this->work = $work;
  13. }
  14. function getWork(){
  15. return $this->work;
  16. }
  17. }
  18. $microsoft = new Work();
  19. $ivan = new Worker($microsoft);
  20.  
  21. echo $ivan->getWork()->getName();
  22. ?>
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
name