3v4l.org

run code in 300+ PHP versions simultaneously
<?php $start_time = "2017-03-20 16:30:00"; $start_mid_night = date_create_from_format("Y-m-d",explode($start_time," ")[0]); var_dump($start_mid_night,explode($start_time," ")[0]); $end_time = "2017-03-22 16:00:00"; $diff = strtotime(str_replace('-','/',$end_time)) - strtotime(str_replace('-','/',$start_time)); print_r( ceil(($diff)/(24*60*60)) ); echo PHP_EOL; print_r( (($diff)/(24*60*60)) );
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.29 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
bool(false) string(1) " " 2 1.9791666666667

preferences:
144.38 ms | 403 KiB | 165 Q