Possible Duplicate:
autoload functions in php
I am working on a PHP framework. I wonder if there is a way to maybe rewrite the error handler when a function doesn't exist to automatically try to include the file stating the function first.
Example:
echo general_foo(); // <-- general_foo() is not yet stated.
// A handler tries to include_once('functions/general.php') based on the first word of the function name.
// If the function still doesn't exist - throw an error.
The win from this would be to skip compiling unnecessary files or to skip keeping track and state includes here and there.
Simply __autoload for functions rather than classes.