php8.5
Home/ Manual/ pthreads / threaded/ Threaded::extend

Threaded::extend

PHP function Edit on GitHub ✎

(PECL pthreads >= 2.0.8)

Runtime Manipulation

Description

Threaded::extend(string $class): bool

Makes thread safe standard class at runtime

Parameters

class

The class to extend

Return Values

Success

Examples

Runtime inheritance

php
<?php
class My {}

Threaded::extend(My::class);

$my = new My();

var_dump($my instanceof Threaded);
?>

The above example will output:

output
bool(true)

Source: reference/pthreads/threaded/extend.xml · from the official PHP manual (php/doc-en)