rename_function

(PECL apd >= 0.2)

rename_functionRenames orig_name to new_name in the global function table

说明

rename_function ( string $original_name , string $new_name ) : bool

Renames a orig_name to new_name in the global function table. Useful for temporarily overriding built-in functions.

参数

original_name

The original function name.

new_name

The new name for the original_name function.

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE

范例

Example #1 rename_function() example

<?php
rename_function
('mysql_connect''debug_mysql_connect' );
?>

User Contributed Notes

schnorxelkuh 27-Dec-2019 12:54
PECL version 1.0.1 of APD will not compile on PHP>5.3.
Search for "pecl-apd" on github to get a patched version (links not permitted here).
Matt 23-Mar-2006 03:23
As of apd 1.0.1, rename_function is case sensitive.  The parameter original_name must be all lowercase for it to work properly.  Your function can still be camel case, for example, but you must specify that function as all lower case for the original_name parameter.