3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php try { $date = new \DateTime('sda'); } catch (\Exception $e) { echo "quak!"; } if ($date) { echo 'yes'; } else { echo 'no'; } try { $date->modify('sda'); } catch(\Exception $e) { echo "Oops!"; } echo $date->format('Y-m-d H:i:s');
based on mjHL0
Output for 7.0.5 - 7.2.0
quak! Notice: Undefined variable: date in /in/O2ALA on line 9 no Notice: Undefined variable: date in /in/O2ALA on line 16 Fatal error: Uncaught Error: Call to a member function modify() on null in /in/O2ALA:16 Stack trace: #0 {main} thrown in /in/O2ALA on line 16
Process exited with code 255.
Output for 7.0.0 - 7.0.4
quak! Notice: Undefined variable: date in /in/O2ALA on line 9 no Notice: Undefined variable: date in /in/O2ALA on line 16 Fatal error: Uncaught Error: Call to a member function modify() on unknown in /in/O2ALA:16 Stack trace: #0 {main} thrown in /in/O2ALA on line 16
Process exited with code 255.
Output for 5.6.8 - 5.6.28
quak! Notice: Undefined variable: date in /in/O2ALA on line 9 no Notice: Undefined variable: date in /in/O2ALA on line 16 Fatal error: Call to a member function modify() on null in /in/O2ALA on line 16
Process exited with code 255.
Output for 5.3.22 - 5.5.35
quak! Notice: Undefined variable: date in /in/O2ALA on line 9 no Notice: Undefined variable: date in /in/O2ALA on line 16 Fatal error: Call to a member function modify() on a non-object in /in/O2ALA on line 16
Process exited with code 255.