Assume you have several arbitrary classes like below:
class Foo
{
$foovar;
public function __construct()
{
$foovar = "Foo";
}
public function getFoo()
{
return($foovar);
}
}
class Bar
{
$F;
public function __construct()
{
$F = new Foo();
}
}
My question is is it possible to write something like the following
$B = new Bar();
echo($B->F->getFoo());
Like I said in my previous question, I come from a strong Java background know you can link variables together System.out.println()
to call other objects methods. I'd like to know if this is possible in PHP