3v4l.org

run code in 300+ PHP versions simultaneously
<?php public function duration($beginn,$ende) { $s = new DateTime($beginn); $e = new DateTime($ende); $interval = new DateInterval('P1M'); $period = new DatePeriod($s, $interval, $e); $m = 0; foreach ($period as $dt) { $m++; } return $m; } echo duration('2014-05-01','2015-04-30');
Output for 5.4.0 - 5.4.27
Parse error: syntax error, unexpected 'public' (T_PUBLIC) in /in/q8ltc on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_PUBLIC in /in/q8ltc on line 3
Process exited with code 255.

preferences:
183 ms | 1395 KiB | 64 Q