You are missing the class instantiation (new), but I think that is my fault, I copied the wrong thing.
<?phpclassSomething{publicfunction__invoke($params){var_dump('Hi there 👋. I invoked myself 😁');}}$something=newSomething();$something(['dev.to','is','really','cool']);var_dump('Did the invoke work? 😕');
Still getting following fatal error
PHP Fatal error: Uncaught Error: Call to undefined function Something() in /home/runner/main.php:12
What am I missing? 😖
repl.it/repls/EssentialMarvelousWe...
You are missing the class instantiation (
new
), but I think that is my fault, I copied the wrong thing.It's working now 🥳 we found the missing key to the puzzle. The invoke variant looked promising but at the end it still requires 2 lines of code.
But thank you Jamieson for showing me this variant. Did not know how to call the magic invoke method #TIL. This can be handy for sure 🤝