Is it possible to call function within the same function without specifying the function name - e.g by using some sort of magic keyword?
Yes. The constant __FUNCTION__ gives you a string representation of the current function. (src)
function testMe() {
print __FUNCTION__;
}
testMe(); // outputs "testMe"
You can then of course use this to call itself:
$func = __FUNCTION__;
$func();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With