3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $currentDate = new DateTime('2016-01-01'); $reportEndDate = new DateTime('2016-05-31'); $months = $currentDate->diff($reportEndDate)->m; var_export($months); var_export(\n); for ($i = 1; $i <= $months ; $i++) { $currentDateImmutable = \DateTimeImmutable::createFromMutable($currentDate); $daysUntilNextMonth = $currentDateImmutable->diff($currentDateImmutable->modify('last day of this month'))->d; var_export($daysUntilNextMonth); var_export("\n"); for ($j = 1; $j <= $daysUntilNextMonth ; $j++) { $currentDate->modify('+1 day'); } var_dump($currentDate); }
based on i32SP
Output for 7.1.0 - 7.3.0beta1
4 Fatal error: Uncaught Error: Undefined constant 'n' in /in/FR5v9:8 Stack trace: #0 {main} thrown in /in/FR5v9 on line 8
Process exited with code 255.
Output for hhvm-3.22.0
4 Fatal error: Uncaught Error: Undefined constant 'n' in /in/FR5v9:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
4 Fatal error: Uncaught Error: Undefined constant 'n' in /in/FR5v9:8 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
4 Fatal error: Undefined constant 'n' in /in/FR5v9 on line 8
Process exited with code 255.