runkit7_method_copy

(PECL runkit7 >= Unknown)

runkit7_method_copy — 클래스에서 다른 클래스로 메소드 복사


설명

runkit7_method_copy(
    string $destination_class,
    string $destination_method_name,
    string $source_class,
    string $source_method_name = ?
): bool
                

매개변수

destination_class
복사된 메서드의 대상 클래스
destination_method_name
대상 메서드 이름
source_class
복사할 메서드의 소스 클래스
source_method_name
소스 클래스에서 복사할 메서드의 이름입니다. 이 매개변수가 생략되면 destination_method_name 값이 가정됩니다.

반환 값


Examples

예제 #1 runkit7_method_copy() 예제

                  
<?php
class Foo {
    function example() {
        return "foo!\n";
    }
}

class Bar {
    // initially, no methods
}

// copy the example() method from the Foo class to the Bar class, as baz()
runkit7_method_copy('Bar', 'baz', 'Foo', 'example');

// output copied function
echo Bar::baz();
?>
                  
                

위의 예는 다음을 출력합니다.

foo!
                

기타