3v4l.org

run code in 300+ PHP versions simultaneously
<?php function async(callable $call): Fiber { $fiber = new Fiber($call); $fiber->start(); return $fiber; } function all(Fiber ...$fibers): array { $all_terminated = function() use($fibers) { foreach($fibers as $fiber) { if (!$fiber->isTerminated()) { return false; } } return true; }; while(!$all_terminated()) { foreach($fibers as $fiber) { if($fiber->isSuspended()) { $fiber->resume(); } } } $res = []; foreach($fibers as $fiber) { $res[] = $fiber->getReturn(); } } function await(Fiber $fiber): mixed { while($fiber->isSuspended()) { $fiber->resume(); } return $fiber->getReturn(); } $a = async(function(): string { ob_start(); // v- called from layout.html.twig Fiber::suspend(); echo '<-- part 1 - layout -->'; return ob_get_clean(); }); $b = async(function(): string { ob_start(); // v- called from layout.html.twig Fiber::suspend(); echo '<-- part 2 - layout -->'; return ob_get_clean(); }); all($a, $b);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: all(): Return value must be of type array, none returned in /in/Zchtr:38 Stack trace: #0 /in/Zchtr(71): all(Object(Fiber), Object(Fiber)) #1 {main} thrown in /in/Zchtr on line 38
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
34.38 ms | 405 KiB | 5 Q