PHP OOP beginner - what is $this->object->method() or anything with 2 arrow -> -


usually understand $this->method() or $this->property or $object->method() or $object->property

but see $this->$object->method(). or has 2 arrow ..->.. -> ..

what mean?

this means $object variable holds field name.

example:

class foo  {     public $bar = 'some string'; }  $foo = new foo(); $field = 'bar'; echo $foo->$field; // prints 'some string' 

then, if method() called on field, means field object.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -