There is any syntax to use something like this?:
<?php
function get_foo() {
return new Foo();
}
get_foo()->foo_method();
?>
Using PHP 5.3 this works fine for me:
<?php
class Foo
{
public function foo_method()
{
print 'hi';
}
}
function get_foo()
{
return new Foo();
}
get_foo()->foo_method();
prints hi
Stuff like this is used all over the place for database wrappers since you can do db()->query($sql) without any trouble.