文字

uopz_implement

(PECL uopz >= 1.0.0)

uopz_implementImplements an interface at runtime

说明

void uopz_implement ( string $class , string $interface )

Makes class implement interface

参数

class

interface

返回值

范例

Example #1 uopz_implement() example

<?php
interface  myInterface  {}

class 
myClass  {}

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

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

以上例程的输出类似于:

array(1) {
  ["myInterface"]=>
  string(11) "myInterface"
}
上一篇: 下一篇: