Thread::getCurrentThread
PHP function
Edit on GitHub ✎
(PECL pthreads >= 2.0.0)
Identification
Description
Thread::getCurrentThread(): Thread
Return a reference to the currently executing Thread
Parameters Parameters
Return Values
An object representing the currently executing Thread
Examples
Return the currently executing Thread
php
<?php
class My extends Thread {
public function run() {
var_dump(Thread::getCurrentThread());
}
}
$my = new My();
$my->start();
?>The above example will output:
output
object(My)#2 (0) {
}