Global "method_missing" in PHP? [duplicate]
Possible Duplicate:
Magic functions __call() for functions?
I can implement __call() to provide method_missing behavior in PHP classes. Is there some way to provide the same functionality in the global scope?
I want something like this:
function __call( $name, $arguments ) {
echo( sprintf( '%s called', $name ) );
}
echo( 'before' );
call_开发者_JAVA百科undefined_function( $a, $b );
echo( 'after' );
Outputs:
before
call_undefined_function called
after
You can write your own error handler and use function_exists()
in it to generate the message you want. As long as you don´t stop your script in your error handler, execution will continue.
精彩评论