Here is something I didn’t know about until today – PHP’s runkit extension:
The runkit extension provides means to modify constants, user-defined functions, and user-defined classes. It also provides for custom superglobal variables and embeddable sub-interpreters via sandboxing.
This blog post – “Shimming PHP for Fun and Profit” – demonstrates how to use it with a case for a custom base64_decode() and unserialize() functions. Here is the actual code on GitHub, which shows off how to use runkit_function_rename() and runkit_function_add().
This is not something one would use frequently, but might be an absolute life saver on a rainy day.