3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $user; public function getUser(): Promise { return new Success($this->user); } } class FooProxy extends Foo { public function getUser(): Promise { return thingReturningAPromise(); } } echo (yield (new FooProxy())->getUser())->getId(); // returns the result of the promise
Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.17, 7.3.0 - 7.3.4
Fatal error: The "yield" expression can only be used inside a function in /in/r1B72 on line 21
Process exited with code 255.

preferences:
156.41 ms | 996 KiB | 7 Q