3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // date_default_timezone_set('Europe/Berlin'); // you are required to set a timezone $date1 = new \DateTime('2009-08-12'); $date2 = new \DateTime('2003-04-14'); $diff = $date1->diff($date2); echo $diff; // echo (($diff->format('%y') * 12) + $diff->format('%m')) . " full months difference";
based on 7Dfcq
Output for 7.1.0 - 7.2.0
Recoverable fatal error: Object of class DateInterval could not be converted to string in /in/oMgEr on line 9
Process exited with code 255.
Output for 5.5.0 - 7.0.20
Catchable fatal error: Object of class DateInterval could not be converted to string in /in/oMgEr on line 9
Process exited with code 255.