(PECL runkit7 >= Unknown)
runkit7_method_rename — Dynamically changes the name of the given method
$classname
, string $methodname
, string $newname
) : boolHinweis: Diese Funktion kann nicht genutzt werden, um die aktuell ausgeführte (oder verkette) Methode zu manipulieren.
classnameThe class in which to rename the method
methodnameThe name of the method to rename
newnameThe new name to give to the renamed method
Gibt bei Erfolg TRUE zurück. Im Fehlerfall wird FALSE zurückgegeben.
Beispiel #1 runkit7_method_rename() example
<?php
class Example {
function foo() {
return "foo!\n";
}
}
// Rename the 'foo' method to 'bar'
runkit7_method_rename(
'Example',
'foo',
'bar'
);
// output renamed function
echo Example::bar();
?>
Das oben gezeigte Beispiel erzeugt folgende Ausgabe:
foo!