3v4l.org

run code in 300+ PHP versions simultaneously
<?php $date = new DateTime(); $numCurDate = $date->format('w'); $numDay = 2; $addInterval = 7 - $numCurDate + $numDay; $date->add(new DateInterval('P'.$addInterval'D')); echo $date->format('w'); //$day_of_week = 1; //$day = DateTime::add('-2 days'); //echo $day->format('w');
Output for 5.4.0 - 5.4.15
Parse error: syntax error, unexpected ''D'' (T_CONSTANT_ENCAPSED_STRING) in /in/E2roH on line 13
Process exited with code 255.
Output for 5.3.0 - 5.3.25
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /in/E2roH on line 13
Process exited with code 255.

preferences:
177.91 ms | 1395 KiB | 49 Q