OpenSwoole\Coroutine::getPcid(int $cid = 0)

25.x is outdated, please check the latest version 26.x


Latest version: pecl install openswoole-26.2.0

Declaration

<?php OpenSwoole\Coroutine::getPcid(int $cid = 0)

Parameters

cid

Coroutine ID. By default, getting the parent coroutine ID of the current coroutine.

Return

cid

Coroutine ID.

Description

Get the parent coroutine ID of a coroutine by coroutine ID.

Example

<?php
co::run(function () {
    echo OpenSwoole\Coroutine::getPcid();
});
Last updated on February 28, 2026