I want to rewrite a function in PHP (let\'s say the mail() function), and want to make it so when I call mail() from now on, it will load my version of mail() and not the de
What you're referring to is generally called method overloading.
While not generally supported by PHP, you actually may be able to redefine internal functions (as well as user functions) using runkit_function_remove() or runkit_function_redefine(). Of course to use that, you'll need to have pretty much full control over the PHP installation - since it's not bundled with PHP you'll need to install the runkit extension.
Again, in a normal situation internal functions as well as user functions cannot be redefined (or overloaded) in PHP. This situation illustrates the benefit of wrapping some internal functions with a user function.