PHP Conference Japan 2024

runkit7_method_remove

(PECL runkit7 >= 未知)

runkit7_method_remove動態移除指定方法

說明

runkit7_method_remove(字串 $class_name, 字串 $method_name): 布林值

注意此函式無法用於操作目前正在執行(或鏈式)的方法。

參數

class_name

要移除方法的類別

method_name

要移除的方法的名稱

回傳值

成功時回傳 true,失敗時回傳 false

範例

範例 #1 runkit7_method_remove() 範例

<?php
class Example {
function
foo() {
return
"foo!\n";
}

function
bar() {
return
"bar!\n";
}
}

// 移除 'foo' 方法
runkit7_method_remove(
'Example',
'foo'
);

echo
implode(' ', get_class_methods('Example'));

?>

以上範例會輸出

bar

另請參閱

新增註解

使用者貢獻的註解

此頁面沒有使用者貢獻的註解。
To Top