• PHP Video Tutorials

PHP - Thread::getCurrentThreadId() Function



Thread::getCurrentThreadId - Identification

Syntax

public static integer Thread::getCurrentThreadId( void )

Thread::getCurrentThreadId() function can return the identity of currently executing Thread.

Thread::getCurrentThreadId() function doesn't have any parameters and can return a numeric identity.

Example

<?php
   class My extends Thread {
      public function run() {
         printf("%s is Thread #%lu\n", __CLASS__, Thread::getCurrentThreadId());
      }
   }
   $my = new My();
   $my->start();
?>
php_function_reference.htm
Advertisements