3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime(); $navDays = [ '-7Days' => (clone DateTime())->modify('-7 days')->format('Y-m-d'), '-1Day' => (clone DateTime())->modify('-1 days')->format('Y-m-d'), 'Today' => (clone DateTime())->format('Y-m-d'), '+1Day' => (clone DateTime())->modify('+1 days')->format('Y-m-d'), '+7Days' => (clone DateTime())->modify('+7 days')->format('Y-m-d') ]; var_dump($navDays);
based on CE1Te
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught Error: Call to undefined function DateTime() in /in/Ysp1f:8 Stack trace: #0 {main} thrown in /in/Ysp1f on line 8
Process exited with code 255.
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ']' in /in/Ysp1f on line 8
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/Ysp1f on line 7
Process exited with code 255.