3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $sStartDate = DateTime::createFromFormat('2013-13-05 21:56:00'); $sEndDate = DateTime::createFromFormat('2013-15-05 21:56:01'); $diff = date_diff($sStartDate, $sEndDate, true); $days = $diff->format('%a'); echo $days; if (1 <= $days) { echo '24 hours or more.'; } else { echo 'less than 24 hours.'; }
based on ASYgl
Output for 7.0.0 - 7.2.0
Warning: DateTime::createFromFormat() expects at least 2 parameters, 1 given in /in/BLgHY on line 3 Warning: DateTime::createFromFormat() expects at least 2 parameters, 1 given in /in/BLgHY on line 4 Warning: date_diff() expects parameter 1 to be DateTimeInterface, boolean given in /in/BLgHY on line 6 Fatal error: Uncaught Error: Call to a member function format() on boolean in /in/BLgHY:8 Stack trace: #0 {main} thrown in /in/BLgHY on line 8
Process exited with code 255.
Output for 5.6.8 - 5.6.28
Warning: DateTime::createFromFormat() expects at least 2 parameters, 1 given in /in/BLgHY on line 3 Warning: DateTime::createFromFormat() expects at least 2 parameters, 1 given in /in/BLgHY on line 4 Warning: date_diff() expects parameter 1 to be DateTimeInterface, boolean given in /in/BLgHY on line 6 Fatal error: Call to a member function format() on boolean in /in/BLgHY on line 8
Process exited with code 255.
Output for 5.5.24 - 5.5.35
Warning: DateTime::createFromFormat() expects at least 2 parameters, 1 given in /in/BLgHY on line 3 Warning: DateTime::createFromFormat() expects at least 2 parameters, 1 given in /in/BLgHY on line 4 Warning: date_diff() expects parameter 1 to be DateTimeInterface, boolean given in /in/BLgHY on line 6 Fatal error: Call to a member function format() on a non-object in /in/BLgHY on line 8
Process exited with code 255.
Output for 5.3.21 - 5.4.45
Warning: DateTime::createFromFormat() expects at least 2 parameters, 1 given in /in/BLgHY on line 3 Warning: DateTime::createFromFormat() expects at least 2 parameters, 1 given in /in/BLgHY on line 4 Warning: date_diff() expects parameter 1 to be DateTime, boolean given in /in/BLgHY on line 6 Fatal error: Call to a member function format() on a non-object in /in/BLgHY on line 8
Process exited with code 255.