3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $yesterday = new \DateTime('yesterday'); $date = new \DateTime('now'); $yesterday->diff($date); $days = (int) $interval->format('%d'); var_dump($days);
Output for 7.0.5 - 7.3.0rc3
Notice: Undefined variable: interval in /in/C8NkA on line 7 Fatal error: Uncaught Error: Call to a member function format() on null in /in/C8NkA:7 Stack trace: #0 {main} thrown in /in/C8NkA on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: interval in /in/C8NkA on line 7 Fatal error: Uncaught Error: Call to a member function format() on unknown in /in/C8NkA:7 Stack trace: #0 {main} thrown in /in/C8NkA on line 7
Process exited with code 255.
Output for hhvm-3.15.4
Notice: Undefined variable: interval in /in/C8NkA on line 7 Fatal error: Uncaught exception 'BadMethodCallException' with message 'Call to a member function format() on a non-object (null)' in /in/C8NkA:7 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Notice: Undefined variable: interval in /in/C8NkA on line 7 Fatal error: Call to a member function format() on null in /in/C8NkA on line 7
Process exited with code 255.