3v4l.org

run code in 300+ PHP versions simultaneously
<?php class DateTimeFactory { const DATE_INTERVAL = 'PT20M'; public static createDateTimeByInterval(DateInterval $dateInterval) { // create DateTime, add Date and/or TimeZone if needed. $dateTime = new DateTime(); return $dateTime->add($dateInterval); } } var_dump(DateTimeFactory::createDateTimeByInterval(new DateInterval(DateTimeFactory::DATE_INTERVAL)));
Output for 5.4.0 - 5.4.24
Parse error: syntax error, unexpected 'createDateTimeByInterval' (T_STRING), expecting variable (T_VARIABLE) in /in/0lSGH on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_STRING, expecting T_VARIABLE in /in/0lSGH on line 7
Process exited with code 255.

preferences:
179.77 ms | 1395 KiB | 61 Q