3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $start = DateTime::createFromFormat('Y-m-d H:i:s', '2019-01-01 07:00:00'); $end = DateTime::createFromFormat('Y-m-d H:i:s', '2019-01-01 10:00:00'); var_dump($start->diff($end)->h); $start = DateTime::createFromFormat('Y-m-d H:i:s', '2018-01-01 07:00:00'); $end = DateTime::createFromFormat('Y-m-d H:i:s', '2019-01-01 10:00:00'); var_dump($start->diff($end)->h);
based on N1sp8
Output for 5.6.30, hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.3.0rc3
int(3) int(3)