zend_thread_id

(PHP 5, PHP 7, PHP 8)

zend_thread_idReturns a unique identifier for the current thread

Description

zend_thread_id(): int

This function returns a unique identifier for the current thread.

Parameters

This function has no parameters.

Return Values

Returns the thread id as an integer.

Examples

Example #1 zend_thread_id() example

<?php
$thread_id 
zend_thread_id();

echo 
'Current thread id is: ' $thread_id;
?>

The above example will output something similar to:

Current thread id is: 7864

Notes

Note:

This function is only available if PHP has been built with ZTS (Zend Thread Safety) support and debug mode (--enable-debug).