<?php class foo{ function bar(){ return $this; } function fetch(){ echo "yeah"; } } $foo = new foo(); $result = $foo->bar(); $result->fetch();