3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $format = 'd/m/Y'; foreach (range(1, 7) as $number) { $difference = strtotime('+' . $number . ' days'); $day = strtolower(date('N', $difference)); var_dump($day); $$day = $difference; } $todayName = date('N'); $$todayName = date($format); var_dump($monday); var_dump($tuesday); var_dump($wednesday); var_dump($thursday); var_dump($friday); var_dump($saturday); var_dump($sunday);
based on Rooll
Output for 5.1.0 - 7.2.0
string(1) "6" string(1) "7" string(1) "1" string(1) "2" string(1) "3" string(1) "4" string(1) "5" Notice: Undefined variable: monday in /in/RHBrV on line 15 NULL Notice: Undefined variable: tuesday in /in/RHBrV on line 16 NULL Notice: Undefined variable: wednesday in /in/RHBrV on line 17 NULL Notice: Undefined variable: thursday in /in/RHBrV on line 18 NULL Notice: Undefined variable: friday in /in/RHBrV on line 19 NULL Notice: Undefined variable: saturday in /in/RHBrV on line 20 NULL Notice: Undefined variable: sunday in /in/RHBrV on line 21 NULL
Output for 5.0.4 - 5.0.5
string(1) "n" string(1) "n" string(1) "n" string(1) "n" string(1) "n" string(1) "n" string(1) "n" Notice: Undefined variable: monday in /in/RHBrV on line 15 NULL Notice: Undefined variable: tuesday in /in/RHBrV on line 16 NULL Notice: Undefined variable: wednesday in /in/RHBrV on line 17 NULL Notice: Undefined variable: thursday in /in/RHBrV on line 18 NULL Notice: Undefined variable: friday in /in/RHBrV on line 19 NULL Notice: Undefined variable: saturday in /in/RHBrV on line 20 NULL Notice: Undefined variable: sunday in /in/RHBrV on line 21 NULL
Output for 4.3.0 - 5.0.3
string(1) "n" string(1) "n" string(1) "n" string(1) "n" string(1) "n" string(1) "n" string(1) "n" Notice: Undefined variable: monday in /in/RHBrV on line 15 NULL Notice: Undefined variable: tuesday in /in/RHBrV on line 16 NULL Notice: Undefined variable: wednesday in /in/RHBrV on line 17 NULL Notice: Undefined variable: thursday in /in/RHBrV on line 18 NULL Notice: Undefined variable: friday in /in/RHBrV on line 19 NULL Notice: Undefined variable: saturday in /in/RHBrV on line 20 NULL Notice: Undefined variable: sunday in /in/RHBrV on line 21 NULL