php8.5
Home/ Manual/ info / functions/ zend_thread_id

zend_thread_id

PHP function Edit on GitHub ✎

(PHP 5, PHP 7, PHP 8)

Returns a unique identifier for the current thread

Description

zend_thread_id(): int

This function returns a unique identifier for the current thread.

Parameters Parameters

Return Values

Returns the thread id as an integer.

Examples

zend_thread_id() example

php
<?php
$thread_id = zend_thread_id();

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

The above example will output something similar to:

output
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).

Source: reference/info/functions/zend-thread-id.xml · from the official PHP manual (php/doc-en)