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!
                

기타