3v4l.org

run code in 300+ PHP versions simultaneously
<?php $epoch = "1394031420"; $newepoch = time(); $start = new DateTime("@$epoch"); $start->modify('first day of this month'); $end = new DateTime("@$newepoch"); $end->modify('first day of next month'); $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); foreach ($period as $dt) { echo $dt->format(M "-" DD "-" y) . PHP_EOL; }
Output for 5.4.0 - 5.4.30
Parse error: syntax error, unexpected '"-"' (T_CONSTANT_ENCAPSED_STRING) in /in/qXZjj on line 15
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /in/qXZjj on line 15
Process exited with code 255.

preferences:
183.51 ms | 1395 KiB | 67 Q