You might get into a situation where you need to hook some PHP function. There are many reasons why you might need to do that. One of the most obvious cases is debugging. In PHP it is really easy to hook any function using override_function which overrides built-in functions. However, these simple “hacks” are practical only in conditions when you’re dealing with your own code or some relatively simple code you can change with ease.
In a more complex situation, like if you need to hook the PHP mail function without messing with some third-party source code you need to do it a bit differently.
…