I noticed on magento, they call a function which is referenced as an object like:
className::function('example')->example;
Which to me makes no sense how it works? I tried to mimic this inside a test file but I get nothing.
<?php
class Example
{
public function test($arg)
{
$want = new ExampleTwo;
return 1;
}
}
class ExampleTwo
{
public $want;
public function urgh($arg)
{
$this->want = "returnn";
}
}
$Obj = new Example;
echo $Obj->test('random')->want;
NOTICE Trying to get property of non-object on line number 24
Can anyone please explain how the function becomes an Object? and if so, how can I then get values from the function object.