3v4l.org

run code in 300+ PHP versions simultaneously
<?php $day_now = date("l"); if($day_now != "Monday"){ $date_beg = date("Y-m-d",strtotime("last Monday")); }else{ $date_beg = date("Y-m-d"); } $ts = $date_beg; $unJour = 3600 * 24; // nombre de secondes dans une journée $ts += 4*$unJour; // 4 jours de plus $date_end = date("Y-m-d",$ts); echo $date_end;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Warning: A non-numeric value encountered in /in/oB9FW on line 10 1970-01-05
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.31, 7.4.0 - 7.4.33
Notice: A non well formed numeric value encountered in /in/oB9FW on line 10 1970-01-05
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.25, 7.0.0 - 7.0.20, 7.3.32 - 7.3.33
1970-01-05

preferences:
172.93 ms | 402 KiB | 225 Q