3v4l.org

run code in 300+ PHP versions simultaneously
<?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 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
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.0.5, 5.1.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.3.11, 4.4.0 - 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.

preferences:
298.85 ms | 401 KiB | 460 Q