Is there any way in PHP to call an object like it\'s a function?
class Funct { public function __callSelf() { echo \'Called!\'; } } $myFunc = new Funct(
You can try with __invoke magic method.
The __invoke() method is called when a script tries to call an object as a function. Note: This feature is available since PHP 5.3.0.
The __invoke() method is called when a script tries to call an object as a function.
Note: This feature is available since PHP 5.3.0.
Try with __construct() or __invoke().
__construct()
__invoke()