3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $zone = new \DateTimeZone( 'GMT' ); $oneOfSeptember2015 = \DateTime::createFromFormat('Y-m-d H:i:s', '2015-09-01', $zone); $oneOfSeptember2014 = \DateTime::createFromFormat('Y-m-d H:i:s', '2014-09-01', $zone); $diff = $now->diff( $oneOfSeptember2015, TRUE ); $dayOfDifference = $diff->format( '%d' ); var_dump( $dayOfDifference );
Output for 7.0.5 - 7.2.0
Notice: Undefined variable: now in /in/BVdfv on line 7 Fatal error: Uncaught Error: Call to a member function diff() on null in /in/BVdfv:7 Stack trace: #0 {main} thrown in /in/BVdfv on line 7
Process exited with code 255.
Output for 7.0.0 - 7.0.4
Notice: Undefined variable: now in /in/BVdfv on line 7 Fatal error: Uncaught Error: Call to a member function diff() on unknown in /in/BVdfv:7 Stack trace: #0 {main} thrown in /in/BVdfv on line 7
Process exited with code 255.
Output for 5.6.7 - 5.6.28
Notice: Undefined variable: now in /in/BVdfv on line 7 Fatal error: Call to a member function diff() on null in /in/BVdfv on line 7
Process exited with code 255.
Output for 5.3.17 - 5.5.35
Notice: Undefined variable: now in /in/BVdfv on line 7 Fatal error: Call to a member function diff() on a non-object in /in/BVdfv on line 7
Process exited with code 255.