重新定义 PHP 函数? [英] Redefining PHP function?
本文介绍了重新定义 PHP 函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我有一个函数:
function this($a){
return $a;
}
如果我想重新定义函数,会不会像重写一样简单?
If I wanted to redefine the function, would it be as simple as rewriting it?
function this($a, $b){ //New this function
return $a * $b;
}
推荐答案
不,会引发错误:
Fatal error: Cannot redeclare foo()
runkit 提供了选项,包括 runkit_function_rename()
和 runkit_function_redefine()
.
The runkit provides options, including runkit_function_rename()
and runkit_function_redefine()
.
这篇关于重新定义 PHP 函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文