3v4l.org

run code in 300+ PHP versions simultaneously
<?php $now = new DateTime('2016-01-10 23:30:59'); $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->format('Y-m-d H:i:s'). PHP_EOL; echo $start->format('Y-m-d H:i:s'). PHP_EOL; echo $end->format('Y-m-d H:i:s'). PHP_EOL; if ($now > $start && $now < $end) { echo 'Error! Please contact administrator!'; } if (true) { $diff = strtotime($departure) - strtotime($now); echo $diff; }
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
2016-01-10 23:30:59 2016-01-09 15:00:00 2016-01-11 08:00:00 Error! Please contact administrator! Fatal error: Uncaught TypeError: strtotime(): Argument #1 ($datetime) must be of type string, DateTime given in /in/GvVYM:13 Stack trace: #0 /in/GvVYM(13): strtotime(Object(DateTime)) #1 {main} thrown in /in/GvVYM on line 13
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
2016-01-10 23:30:59 2016-01-09 15:00:00 2016-01-11 08:00:00 Error! Please contact administrator! Warning: strtotime() expects parameter 1 to be string, object given in /in/GvVYM on line 13 Warning: strtotime() expects parameter 1 to be string, object given in /in/GvVYM on line 13 0

preferences:
254.82 ms | 403 KiB | 330 Q