PHP version 5.3 introduced a new magic method designed __invoke, this method is called when a script tries to call an object as a function.
The __invoke magic method
By running this piece of code you can expect the following output:I am an object of type: Car Just called object as function with parameter 'ford'
As php cannot accommodate pseudo-first-class functions, the __invoke method can be used to suppress this language limitation. On other hand you can use this for simpler things as pass a function around.
This can be a neat feature of the language for some developers and a complete headache for others, because it will make the code less clean, in my opinion.
More details about the __invoke magic method on PHP Manual.
What's your experience with the __invoke method usage ?