There is an extension that allows you to override functions. It is meant to be used for debugging, but I guess you can use it for your needs. Take a look:
http://www.php.net/manual/en/function.override-function.php
If you wish to call the original function within your version, make sure you read this comment:
http://no.php.net/manual/en/function.override-function.php#50821