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)) );

preferences:
55.62 ms | 402 KiB | 5 Q