3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $sStart = '2013-13-05T21:56:00'; $sEnd = '2013-15-05T21:56:01'; $sStartDate = new DateTime($sStart); $sEndDate = new DateTime($sEnd); $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 cq1H9
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Exception: DateTime::__construct(): Failed to parse time string (2013-13-05T21:56:00) at position 6 (3): Unexpected character in /in/ASYgl:6 Stack trace: #0 /in/ASYgl(6): DateTime->__construct('2013-13-05T21:5...') #1 {main} thrown in /in/ASYgl on line 6
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): Failed to parse time string (2013-13-05T21:56:00) at position 6 (3): Unexpected character' in /in/ASYgl:6 Stack trace: #0 /in/ASYgl(6): DateTime->__construct('2013-13-05T21:5...') #1 {main} thrown in /in/ASYgl on line 6
Process exited with code 255.