runkit7_method_rename
(PECL runkit7 >= Unknown)
runkit7_method_rename — 주어진 메소드의 이름을 동적으로 변경
설명
runkit7_method_rename(string $class_name
, string $source_method_name
, string $target_method_name
): bool
참고: 이 함수는 현재 실행 중인(또는 연결된) 메서드를 조작하는 데 사용할 수 없습니다.
매개변수
class_name
- 메서드의 이름을 바꿀 클래스
source_method_name
- 이름을 바꿀 메서드의 이름
target_method_name
- 이름이 바뀐 메서드에 부여할 새 이름
반환 값
성공하면 true
를, 실패하면 false
를 반환합니다.
Examples
예제 #1 runkit7_method_rename() 예제
<?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();
?>
위의 예는 다음을 출력합니다.
foo!
기타
- runkit7_method_add() - 주어진 클래스에 새로운 메소드를 동적으로 추가
- runkit7_method_copy() - 클래스에서 다른 클래스로 메소드 복사
- runkit7_method_redefine() - 주어진 메소드의 코드를 동적으로 변경
- runkit7_method_remove() - 주어진 메소드를 동적으로 제거
- runkit7_function_rename() - 함수 이름 변경