<?php class Wtf { public function __get($property) { \Fiber::suspend(); echo "hi " . $property . "\n"; } } $fibers[] = new \Fiber(function () { $wtf = new Wtf(); echo $wtf->a; }); $fibers[] = new \Fiber(function () { $wtf = new Wtf(); echo $wtf->b; }); while (\count($fibers) > 0) { foreach ($fibers as $key => $fiber) { if (!$fiber->isStarted()) { $fiber->start(); } elseif ($fiber->isSuspended()) { $fiber->resume(); } // If the Fiber hasn't terminated by this point, move onto the next // placeholder, we'll resume this Fiber again when we get back here. if (!$fiber->isTerminated()) { continue; } unset($fibers[$key]); } }
You have javascript disabled. You will not be able to edit any code.