This is a bit of a crazy idea, but would there be a way to bootstrap all the functions that php have without using a helper function to call the functions.
What I mean is actually calling some code or function before and after every basic function call.
Example:
<?php
echo "Hello";
?>
But these functions would be called before echo and after echo:
<?php
function pre_echo()
{
do_something();
}
function post_echo()
{
do_something_else();
}
?>
"Bootstrapping" is not the correct term here - what you want to do is called Aspect-oriented Programming, and yes, it can be done in PHP. However, it seems to require substantial changes to the way you normally use PHP.
Just as an FYI, your example picked something which isn't actually a function in the strictest sense, echo is a language construct and handled differently by the PHP internals.
I think there's only two ways to achieve what you are after though:
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