uopz_implement

(PECL uopz 1, PECL uopz 2, PECL uopz 5, PECL uopz 6, PECL uopz 7 < 7.1.0)

uopz_implement — 런타임에 인터페이스를 구현합니다.


설명

uopz_implement(string $class, string $interface): bool

class 구현 interface 만들기


매개변수

class
interface

반환 값

성공하면 true를, 실패하면 false를 반환합니다.


오류/예외

PHP 7.4.0부터 uopz_implements()OPcache가 활성화되고 class의 클래스 항목이 변경 불가능한 경우 RuntimeException을 발생시킵니다.


Examples

예제 #1 기본 uopz_implement() 예

                  
<?php
interface myInterface {}

class myClass {}

uopz_implement(myClass::class, myInterface::class);

var_dump(class_implements(myClass::class));
?>
                  
                

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

array(1) {
  ["myInterface"]=>
  string(11) "myInterface"
}