Is it allowed to chain invoke method in PHP?

Viewed 200

for example, I have following:

class A{
  __invoke(){
    // return an instance of class A itself
  }
}

so can I do the following?

new A()()()()... or (new A())()()()...

and what is the explanation here? suppose PHP version is newer than 5.4

Ok, I may give a little more explanation why I ask: I was using ganon.php which is an open source html dom parser. It is using syntax like $html_node('child_tag') to return another child $html_node where $html_node is an object instance of class HTML_NODE. So I was thinking if I could use chaining to do the selection in a nested html dom structure.

2 Answers
Related