3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __wakeup() { echo 'In foo', PHP_EOL, PHP_EOL; throw new \Exception('Foo'); } public function __destruct() { echo 'Destruct foo', PHP_EOL, PHP_EOL; throw new \Exception('Foo destruct'); } } class Bar { public function __wakeup() { echo 'In bar', PHP_EOL, PHP_EOL; throw new \Exception('Bar'); } public function __destruct() { echo 'Destruct bar', PHP_EOL, PHP_EOL; throw new \Exception('Bar destruct'); } } try { unserialize(serialize([$f = new Foo, $b = new Bar])); } catch (\Throwable $e) { echo $e, PHP_EOL, PHP_EOL; } echo "==========", PHP_EOL, PHP_EOL; try { unserialize(serialize([$b, $f])); } catch (\Throwable $e) { echo $e, PHP_EOL, PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
In foo Exception: Foo in /in/82UJj:6 Stack trace: #0 [internal function]: Foo->__wakeup() #1 /in/82UJj(28): unserialize('a:2:{i:0;O:3:"F...') #2 {main} ========== In bar Exception: Bar in /in/82UJj:18 Stack trace: #0 [internal function]: Bar->__wakeup() #1 /in/82UJj(36): unserialize('a:2:{i:0;O:3:"B...') #2 {main} Destruct bar Fatal error: Uncaught Exception: Bar destruct in /in/82UJj:23 Stack trace: #0 [internal function]: Bar->__destruct() #1 {main} thrown in /in/82UJj on line 23
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:
54.72 ms | 401 KiB | 8 Q