3v4l.org

run code in 300+ PHP versions simultaneously
<?php $lastDate = new DateTime('2019-03-01'); $firstDate = new DateTime('2019-01-01'); $dateInterval = $lastDate->diff($firstDate); var_dump($dateInterval);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.30, 7.4.0 - 7.4.23, 8.0.0 - 8.0.11
object(DateInterval)#3 (16) { ["y"]=> int(0) ["m"]=> int(1) ["d"]=> int(28) ["h"]=> int(0) ["i"]=> int(0) ["s"]=> int(0) ["f"]=> float(0) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(59) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }

preferences:
119.79 ms | 403 KiB | 131 Q