3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __set($prop, $value) { echo "__set($prop, $value)\n"; Fiber::suspend(); } } $foo = new Foo(); $fiber = new Fiber(function () use ($foo) { $foo->bar = 'bar'; }); $value = $fiber->start(); $foo->bar = 'baz'; $fiber->resume('test');
Output for 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1
__set(bar, bar) Deprecated: Creation of dynamic property Foo::$bar is deprecated in /in/KH2oE on line 17
Output for 8.1.0 - 8.1.31
__set(bar, bar)
Output for 8.0.1 - 8.0.30
Fatal error: Uncaught Error: Class "Fiber" not found in /in/KH2oE:12 Stack trace: #0 {main} thrown in /in/KH2oE on line 12
Process exited with code 255.

preferences:
63.3 ms | 408 KiB | 5 Q