3v4l.org

run code in 300+ PHP versions simultaneously
<?php $format = 'd/m/Y'; foreach (range(1, 7) as $number) { $difference = date($format, strtotime('+' . $number . ' days')); $day = strtolower(date('l', $difference)); $$day = $difference; } $todayName = strtolower(date('l')); $$todayName = date($format); var_dump($monday); var_dump($tuesday); var_dump($wednesday); var_dump($thursday); var_dump($friday); var_dump($saturday); var_dump($sunday);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: date(): Argument #2 ($timestamp) must be of type ?int, string given in /in/LkSrl:7 Stack trace: #0 /in/LkSrl(7): date('l', '09/05/2015') #1 {main} thrown in /in/LkSrl on line 7
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.38, 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: A non well formed numeric value encountered in /in/LkSrl on line 7 Notice: A non well formed numeric value encountered in /in/LkSrl on line 7 Notice: A non well formed numeric value encountered in /in/LkSrl on line 7 Notice: A non well formed numeric value encountered in /in/LkSrl on line 7 Notice: A non well formed numeric value encountered in /in/LkSrl on line 7 Notice: A non well formed numeric value encountered in /in/LkSrl on line 7 Notice: A non well formed numeric value encountered in /in/LkSrl on line 7 Notice: Undefined variable: monday in /in/LkSrl on line 14 NULL Notice: Undefined variable: tuesday in /in/LkSrl on line 15 NULL Notice: Undefined variable: wednesday in /in/LkSrl on line 16 NULL string(10) "15/05/2015" string(10) "08/05/2015" Notice: Undefined variable: saturday in /in/LkSrl on line 19 NULL Notice: Undefined variable: sunday in /in/LkSrl on line 20 NULL
Output for 7.3.32 - 7.3.33
NULL NULL NULL string(10) "15/05/2015" string(10) "08/05/2015" NULL NULL
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: monday in /in/LkSrl on line 14 NULL Notice: Undefined variable: tuesday in /in/LkSrl on line 15 NULL Notice: Undefined variable: wednesday in /in/LkSrl on line 16 NULL string(10) "15/05/2015" string(10) "08/05/2015" Notice: Undefined variable: saturday in /in/LkSrl on line 19 NULL Notice: Undefined variable: sunday in /in/LkSrl on line 20 NULL
Output for 4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.3
Notice: Undefined variable: monday in /in/LkSrl on line 14 NULL Notice: Undefined variable: tuesday in /in/LkSrl on line 15 NULL Notice: Undefined variable: wednesday in /in/LkSrl on line 16 NULL string(10) "15/05/2015" string(10) "08/05/2015" Notice: Undefined variable: saturday in /in/LkSrl on line 19 NULL Notice: Undefined variable: sunday in /in/LkSrl on line 20 NULL

preferences:
275.77 ms | 402 KiB | 424 Q