PHP have different namespaces for methods and value attributes.
<?php
class C {
function d() {
return "d-value";
}
}
class B {
public $c;
function __construct() {
$this->c = new C;
}
function c() {
return "c-value";
}
}
class A {
public $b;
function __construct() {
$this->b = new B;
}
function b() {
return "b-value";
}
}
$a = new A;
echo $a->b() . PHP_EOL;
echo $a->b->c() . PHP_EOL;
echo $a->b->c->d() . PHP_EOL;
--
b-value
c-value
d-value