array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'function.runkit7-method-rename.php', 1 => 'runkit7_method_rename', ), 'up' => array ( 0 => 'ref.runkit7.php', 1 => 'runkit7 Funktionen', ), 'prev' => array ( 0 => 'function.runkit7-method-remove.php', 1 => 'runkit7_method_remove', ), 'next' => array ( 0 => 'function.runkit7-object-id.php', 1 => 'runkit7_object_id', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/runkit7/functions/runkit7-method-rename.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL runkit7 >= Unknown)
runkit7_method_rename — Dynamically changes the name of the given method
$class_name
, string $source_method_name
, string $target_method_name
): boolHinweis: Diese Funktion kann nicht genutzt werden, um die aktuell ausgeführte (oder verkette) Methode zu manipulieren.
class_name
The class in which to rename the method
source_method_name
The name of the method to rename
target_method_name
The new name to give to the renamed method
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 (new Example)->bar();
?>
Das oben gezeigte Beispiel erzeugt folgende Ausgabe:
foo!