PHP.nl

uopz_implement

uopz_implement

Implements an interface at runtime

bool **uopz_implement** string $class string $interface

Makes implement class``interface

class

interface

return.success

As of PHP 7.4.0, throws a , if is enabled, and the class entry of is immutable. uopz_implements``RuntimeExceptionOPcacheclass

Voorbeeld: example

<?php
interface myInterface {}

class myClass {}

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

var_dump(class_implements(myClass::class));
?>
array(1) {
  ["myInterface"]=>
  string(11) "myInterface"
}