Coroutine::getSuspendFileAndLine
(PHP 8.6+, True Async 1.0)
php
public Coroutine::getSuspendFileAndLine(): arrayReturns the file and line number where the coroutine was suspended (or was last suspended).
Return Value
array -- an array of two elements:
[0]-- file name (stringornull)[1]-- line number (int)
Examples
Example #1 Basic usage
php
<?php
use function Async\spawn;
use function Async\suspend;
$coroutine = spawn(function() {
suspend(); // line 7
});
suspend(); // let the coroutine suspend
[$file, $line] = $coroutine->getSuspendFileAndLine();
echo "Suspended at: $file:$line\n"; // /app/script.php:7See Also
- Coroutine::getSuspendLocation -- Suspension location as a string
- Coroutine::getSpawnFileAndLine -- Creation file and line