3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $date = new DateTime('2013-01-01'); $date2 = clone $date; for($i = 1; $i <= 10; $i ++) { $date2->modify("+1 month +3 day"); printf("Date: %s \nExpected : %d\nRecived : %s\n\n", $date2->format("Y-m-d"), $i * 34, $date->diff($date2)->format("%a")); }
Output for 5.3.0 - 7.1.0
Date: 2013-02-04 Expected : 34 Recived : 34 Date: 2013-03-07 Expected : 68 Recived : 65 Date: 2013-04-10 Expected : 102 Recived : 99 Date: 2013-05-13 Expected : 136 Recived : 132 Date: 2013-06-16 Expected : 170 Recived : 166 Date: 2013-07-19 Expected : 204 Recived : 199 Date: 2013-08-22 Expected : 238 Recived : 233 Date: 2013-09-25 Expected : 272 Recived : 267 Date: 2013-10-28 Expected : 306 Recived : 300 Date: 2013-12-01 Expected : 340 Recived : 334
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/j1UXd on line 7
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/j1UXd on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/j1UXd on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_VARIABLE in /in/j1UXd on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/j1UXd on line 3
Process exited with code 255.