(PECL runkit7 >= 未知)
runkit7_function_redefine — 使用新的實作取代函式定義
$function_name
,$argument_list
,$code
,$return_by_reference
= null
,$doc_comment
= null
,$return_type
= ?,$is_strict
= ?$function_name
,$closure
,$doc_comment
= null
,$return_type
= ?,$is_strict
= ?注意:預設情況下,只有使用者空間的函式可以被移除、重新命名或修改。若要覆寫內建函式,您必須在 php.ini 中啟用
runkit.internal_override
設定。
function_name
要重新定義的函式名稱
argument_list
函式將接受的新參數列表
code
新的程式碼實作
closure
定義函式的 閉包。
return_by_reference
函式是否應該透過引用返回。
doc_comment
函式的文件註釋。
return_type
函式的返回類型。
is_strict
函式是否如同在 strict_types=1
的檔案中宣告一樣運作
範例 #1 runkit7_function_redefine() 範例
<?php
function testme() {
echo "原始 Testme 實作\n";
}
testme();
runkit7_function_redefine('testme','','echo "新的 Testme 實作\n";');
testme();
?>
上述範例將輸出
Original Testme Implementation New Testme Implementation