3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime(); $cur_date = $date->format('w'); $day_of_week = 1; $date::add('-2 days');
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught Error: Non-static method DateTime::add() cannot be called statically in /in/8CteI:7 Stack trace: #0 {main} thrown in /in/8CteI on line 7
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Warning: add() expects parameter 1 to be object, string given in /in/8CteI on line 7
Output for 5.5.0 - 5.6.28
Fatal error: Non-static method DateTime::add() cannot be called statically in /in/8CteI on line 7
Process exited with code 255.
Output for 5.4.0 - 5.4.45
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone.' in /in/8CteI:3 Stack trace: #0 /in/8CteI(3): DateTime->__construct() #1 {main} thrown in /in/8CteI on line 3
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'Europe/Berlin' for 'CEST/2.0/DST' instead' in /in/8CteI:3 Stack trace: #0 /in/8CteI(3): DateTime->__construct() #1 {main} thrown in /in/8CteI on line 3
Process exited with code 255.
Output for 5.2.3 - 5.2.17
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in /in/8CteI on line 7
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.2
<br /> <b>Parse error</b>: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in <b>/in/8CteI</b> on line <b>7</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
<br /> <b>Parse error</b>: parse error, unexpected T_PAAMAYIM_NEKUDOTAYIM in <b>/in/8CteI</b> on line <b>7</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.3.4
<br /> <b>Parse error</b>: parse error in <b>/in/8CteI</b> on line <b>7</b><br />
Process exited with code 255.