php4>phpcli -r "class a { function &ref(){ return $this;} function e(){ echo 'Foo'; } } $a=new a; $a->ref()->e();" Parse error: syntax error, unexpected T_OBJECT_OPERATOR in Command line code on line 1 php5>php -r "class a { function &ref(){ return $this; } function e(){ echo 'Foo'; } } $a=new a; $a->ref()->e();" Foo