Forum und email

runkit_function_redefine

(PECL runkit:0.7-0.9)

runkit_function_redefine — Replace a function definition with a new implementation

說明

bool runkit_function_redefine ( string $funcname , string $arglist , string $code )

Note: 預設情況下,只有用戶空間的函式可以被刪除,重命名,或者修改。要覆蓋內部函式,必須啟用全系統範圍的 php.ini 文件中的 runkit.internal_override 選項。

參數

funcname

Name of function to redefine

arglist

New list of arguments to be accepted by function

code

New code implementation

Return值

如果成功則回傳 TRUE,失敗則回傳 FALSE

範例

Example#1 A runkit_function_redefine() example

<?php
function testme() {
  echo 
"Original Testme Implementation\n";
}
testme();
runkit_function_redefine('testme','','echo "New Testme Implementation\n";');
testme();
?>

上例將輸出:

Original Testme Implementation
New Testme Implementation