A small confusion arose after reading OOP in php, that is, I understand such constructs

echo $this->property; echo $this->method(); 

But such things are not logically clear, please explain

 echo $this->property->method(); 

If you need to clarify something in the question write

  • this means property is also an object, the method which you call, the same is in other languages - BOPOH
  • Can you give an example? to make out in detail - MaximPro
  • one
    public function __construct() { $this->property = new Some_Class(); } public function __construct() { $this->property = new Some_Class(); } , and then somewhere in the classroom you can already $this->property->some_method() - BOPOH
  • one
    one object is nested in another $ a-> property = new B (), the nested object can also pull methods in the same way ... - kroder
  • one
    The same, by the way, can be done with the methods. If the result of the method to return an object ..... as a rough example ideone.com/NqNMRz ........ it also includes what the raven described too - Alexey Shimansky

0