PHP.nl

uopz_extend

uopz_extend

Extend a class at runtime

bool **uopz_extend** string $class string $parent

Makes extend class``parent

classThe name of the class to extend

parentThe name of the class to inherit

return.success

As of PHP 7.4.0, throws a , if is enabled, and the class entry of either or (if it is a trait) is immutable. uopz_extends``RuntimeExceptionOPcacheclass``parent

Voorbeeld: example

<?php
class A {}
class B {}

uopz_extend(A::class, B::class);

var_dump(class_parents(A::class));
?>
array(1) {
  ["B"]=>
  string(1) "B"
}