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)->format('Y-m-d'), '+1Day' => (clone $date)->modify('+1 days')->format('Y-m-d'), '+7Days' => (clone $date)->modify('+7 days')->format('Y-m-d') ]; var_dump($navDays);
based on rHetG
Output for 7.0.20 - 7.2.0
array(5) { ["-7Days"]=> string(10) "2015-12-15" ["-1Day"]=> string(10) "2015-12-21" ["Today"]=> string(10) "2015-12-22" ["+1Day"]=> string(10) "2015-12-23" ["+7Days"]=> string(10) "2015-12-29" }
Output for 7.0.6
array(5) { ["-7Days"]=> string(10) "2016-05-14" ["-1Day"]=> string(10) "2016-05-20" ["Today"]=> string(10) "2016-05-21" ["+1Day"]=> string(10) "2016-05-22" ["+7Days"]=> string(10) "2016-05-28" }
Output for 7.0.5
array(5) { ["-7Days"]=> string(10) "2016-03-27" ["-1Day"]=> string(10) "2016-04-02" ["Today"]=> string(10) "2016-04-03" ["+1Day"]=> string(10) "2016-04-04" ["+7Days"]=> string(10) "2016-04-10" }
Output for 7.0.4
array(5) { ["-7Days"]=> string(10) "2016-03-03" ["-1Day"]=> string(10) "2016-03-09" ["Today"]=> string(10) "2016-03-10" ["+1Day"]=> string(10) "2016-03-11" ["+7Days"]=> string(10) "2016-03-17" }
Output for 7.0.3
array(5) { ["-7Days"]=> string(10) "2016-03-11" ["-1Day"]=> string(10) "2016-03-17" ["Today"]=> string(10) "2016-03-18" ["+1Day"]=> string(10) "2016-03-19" ["+7Days"]=> string(10) "2016-03-25" }
Output for 7.0.2
array(5) { ["-7Days"]=> string(10) "2016-03-16" ["-1Day"]=> string(10) "2016-03-22" ["Today"]=> string(10) "2016-03-23" ["+1Day"]=> string(10) "2016-03-24" ["+7Days"]=> string(10) "2016-03-30" }
Output for 7.0.1
array(5) { ["-7Days"]=> string(10) "2016-03-17" ["-1Day"]=> string(10) "2016-03-23" ["Today"]=> string(10) "2016-03-24" ["+1Day"]=> string(10) "2016-03-25" ["+7Days"]=> string(10) "2016-03-31" }
Output for 7.0.0
array(5) { ["-7Days"]=> string(10) "2016-03-20" ["-1Day"]=> string(10) "2016-03-26" ["Today"]=> string(10) "2016-03-27" ["+1Day"]=> string(10) "2016-03-28" ["+7Days"]=> string(10) "2016-04-03" }
Output for 5.4.11 - 5.6.21
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ']' in /in/Bic7S on line 6
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/Bic7S on line 5
Process exited with code 255.