class test {
public function hello() {
echo "hello!";
}
public function assign() {
$var = $this->hello();
$this->hello(); //both seem to be doing the same thing
}
}
This is a simplified example of a piece of code that I am talking about, which is here on line 43: https://eval.in/988393
What is the point of a assigning a method call (I guess this is how it is called) to a variable and what is the explanation of this causing it to get run (it does not just assign it but it executes the code).
PS: This is actually related to Iterators like here: http://php.net/manual/en/class.iterator.php . Somebody told me this:
"The point with iterators is that you do not care how the methods are called, you only care about each single method separatly".
What did this person mean?