php8.5
Home/ Manual/ pthreads / thread/ Thread::getCreatorId

Thread::getCreatorId

PHP function Edit on GitHub ✎

(PECL pthreads >= 2.0.0)

Identification

Description

Thread::getCreatorId(): int

Will return the identity of the Thread that created the referenced Thread

Parameters Parameters

Return Values

A numeric identity

Examples

Return the identity of the Thread or Process that created the referenced Thread

php
<?php
class My extends Thread {
    public function run() {
        printf("%s created by Thread #%lu\n", __CLASS__, $this->getCreatorId());
    }
}
$my = new My();
$my->start();
?>

The above example will output:

output
My created by Thread #123456778899

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