Hi!
<?
class Foo {
function getMessage() {
return "foo";
}
}
class Bar {
function getFoo() {
return new Foo();
}
}
$bar = new Bar();
echo $bar->getFoo()->getMessage();
?>
Running this you will get a parse error on the line with:
echo $bar->getFoo()->getMessage();
In an object oriented manner I would like to argue that this expression is
completely valid. However it won't work in PHP and it annoys me. Is there
any other way of doing it without using a variable?
i.e.
$foo = $bar->getFoo();
$foo->getMessage();
The reason I don't want to use another variable is that I want to be able to
say:
<?=$bar->getFoo()->getMessage()?>.
All the best,
--
Erik Andersson ( E.N.E IT - Australia )
http://www.eneit.com/
- Australian, high quality web hosting from AU$4.95, all features included.