note 126695 added to fiber.start
| From: | Astrid at main dot php dot net | Date: | Sat, 18 Dec 2021 13:49:34 +0000 |
| Subject: | note 126695 added to fiber.start | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-217387@lists.php.net to get a copy of this message | ||
Maybe this helps wrapping your had around the start-suspend-resume-return circle:
$fiber = new Fiber(
function($one) {
$two = Fiber::suspend($one);
$three = Fiber::suspend($two);
$four = Fiber::suspend($three);
$five = Fiber::suspend($four);
$six = Fiber::suspend($five);
return $six;
}
);
print $fiber->start(1);
print $fiber->resume(2);
print $fiber->resume(3);
print $fiber->resume(4);
print $fiber->resume(5);
print $fiber->resume(6);
print $fiber->getReturn();
//prints 123456
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.85.242 (proxied: 94.216.68.190)
----
Manual Page -- https://php.net/manual/en/fiber.start.php
Edit -- https://main.php.net/note/edit/126695
Del: integrated -- https://main.php.net/note/delete/126695/integrated
Del: useless -- https://main.php.net/note/delete/126695/useless
Del: bad code -- https://main.php.net/note/delete/126695/bad+code
Del: spam -- https://main.php.net/note/delete/126695/spam
Del: non-english -- https://main.php.net/note/delete/126695/non-english
Del: in docs -- https://main.php.net/note/delete/126695/in+docs
Del: other reasons-- https://main.php.net/note/delete/126695
Reject -- https://main.php.net/note/reject/126695
Search -- https://main.php.net/manage/user-notes.php