<?php class Foo { public $message = 'none'; public function __construct($message) { $this->message = $message; } } $foo = new Foo('hello'); $foo->bar = new Foo('bar');
Standard input is empty
object(Foo)#1 (2) { ["message"]=> string(5) "hello" ["bar"]=> object(Foo)#2 (1) { ["message"]=> string(3) "bar" } }