3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ToS{function __toString(){die("hi");}} //$e=new exception; $e=unserialize('O:9:"Exception":1:{s:8:"previous";O:3:"ToS":0:{}}'); echo $e;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: Cannot assign ToS to property Exception::$previous of type ?Throwable in /in/JHUoD:4 Stack trace: #0 /in/JHUoD(4): unserialize('O:9:"Exception"...') #1 {main} thrown in /in/JHUoD on line 4
Process exited with code 255.
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Undefined property: Exception::$previous in /in/JHUoD on line 5 Notice: Undefined property: Exception::$previous in /in/JHUoD on line 5 Exception in /in/JHUoD:4 Stack trace: #0 /in/JHUoD(4): unserialize('O:9:"Exception"...') #1 {main}
Output for 7.0.10 - 7.0.33, 7.1.0 - 7.1.33, 7.3.32 - 7.3.33
Exception in /in/JHUoD:4 Stack trace: #0 /in/JHUoD(4): unserialize('O:9:"Exception"...') #1 {main}
Output for 7.0.0 - 7.0.9
Notice: Undefined property: Exception::$previous in /in/JHUoD on line 5 Exception in /in/JHUoD:4 Stack trace: #0 /in/JHUoD(4): unserialize('O:9:"Exception"...') #1 {main}
Output for 5.4.0 - 5.4.43, 5.5.0 - 5.5.27, 5.6.0 - 5.6.11, 5.6.25 - 5.6.40
exception 'Exception' in /in/JHUoD:4 Stack trace: #0 /in/JHUoD(4): unserialize('O:9:"Exception"...') #1 {main}
Output for 5.4.44 - 5.4.45, 5.5.28 - 5.5.38, 5.6.12 - 5.6.24
Notice: Undefined property: Exception::$previous in /in/JHUoD on line 5 exception 'Exception' in /in/JHUoD:4 Stack trace: #0 /in/JHUoD(4): unserialize('O:9:"Exception"...') #1 {main}

preferences:
239.89 ms | 402 KiB | 374 Q