zend_thread_id()

zend_thread_id() — Returns a unique identifier for the current thread.

Built-in function of PHP 8.5. The manual lists it as available in PHP 5, PHP 7, PHP 8. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

Signature

zend_thread_id(): int

Parameters

This function takes no parameters.

Return value

Returns the thread id as an integer.

Example

A runnable snippet:

$thread_id = zend_thread_id(); echo 'Current thread id is: ' . $thread_id;

Output:

Current thread id is: 7864

All PHP 8.5 built-in functions

Reference card built from the PHP manual page zend_thread_id() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.