3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $d1 = new DateTime( date('Y-m-d') ); $data_1 = $d1->format('Y-m-d'); $pd = $d1->modify('+182 day'); $data_2 = $pd->format('Y-m-d'); var_dump($data_1, $data_2);
Output for 5.3.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
string(10) "2014-04-04" string(10) "2014-10-03"
Output for 5.2.0 - 5.2.17
Fatal error: Call to a member function format() on a non-object in /in/FBmuO on line 8
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/FBmuO on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/FBmuO on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/FBmuO on line 4