php8.5
Home/ Manual/ runkit7 / functions/ runkit7_method_remove

runkit7_method_remove

PHP function Edit on GitHub ✎

(PECL runkit7 >= Unknown)

Dynamically removes the given method

Description

runkit7_method_remove(string $class_name, string $method_name): bool

Selfmanipulation

Parameters

class_name

The class in which to remove the method

method_name

The name of the method to remove

Return Values

Success

Examples

runkit7_method_remove() example

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

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

// Remove the 'foo' method
runkit7_method_remove(
    'Example',
    'foo'
);

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

?>

The above example will output:

output
bar

See Also

Source: reference/runkit7/functions/runkit7-method-remove.xml · from the official PHP manual (php/doc-en)