3v4l.org

run code in 300+ PHP versions simultaneously
<?php public function diffInDays(\DateTime $dateEnd, \DateTime $dateStart) { $interval = $dateEnd->diff($dateStart); return (int) $interval->format('%a'); } $startDate = new \DateTime('2015-11-09 21:00:00.000000', new \DateTimeZone('UTC')); $endDate = new \DateTime('2015-11-08 21:00:00.000000', new \DateTimeZone('UTC')); var_dump(diffInDays($startDate, $startDate));
Output for 7.0.0 - 7.0.1
Parse error: syntax error, unexpected 'public' (T_PUBLIC), expecting end of file in /in/a9del on line 3
Process exited with code 255.
Output for 5.5.24 - 5.5.30, 5.6.8 - 5.6.16
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/a9del on line 3
Process exited with code 255.

preferences:
175.66 ms | 1395 KiB | 25 Q