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', 2 => 'Dynamically changes the name of the given method', ), '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', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

runkit7_method_rename

(PECL runkit7 >= Unknown)

runkit7_method_renameDynamically changes the name of the given method

Beschreibung

runkit7_method_rename(string $class_name, string $source_method_name, string $target_method_name): bool

Hinweis: Diese Funktion kann nicht genutzt werden, um die aktuell ausgeführte (oder verkette) Methode zu manipulieren.

Parameter-Liste

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

Rückgabewerte

Gibt bei Erfolg true zurück. Bei einem Fehler wird false zurückgegeben.

Beispiele

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!

Siehe auch