3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $now = new DateTime; $start = new DateTime('saturday this week 15:00'); $end = new DateTime('monday next week 08:00'); $departure = new DateTime('2016-01-11 23:30:59'); echo $now; echo $start; echo $end; if ($now > $start && $now < $end && $departure->diff($now)->hours <= 72) { echo 'Error! Please contact administrator!'; } $now = new DateTimeImmutable; $departure = $now->modify('+42 hours'); echo $now->format('Y-m-d H:i:s') . PHP_EOL; echo $departure->format('Y-m-d H:i:s') . PHP_EOL; echo $now->diff($departure)->format('%h') . PHP_EOL;
based on ppgdM
Output for 7.1.0 - 7.2.0
Recoverable fatal error: Object of class DateTime could not be converted to string in /in/X4QVb on line 6
Process exited with code 255.
Output for 5.3.21 - 7.0.20
Catchable fatal error: Object of class DateTime could not be converted to string in /in/X4QVb on line 6
Process exited with code 255.