3v4l.org

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