3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $d = new DateTimeImmutable('2015-11-16'); $d2 = $d->setDate(1980, 10, 29); print $d2->format('c') . PHP_EOL; $d3 = $d2->modify('+1 day'); print $d3->format('c') . PHP_EOL; print $d1->format('c') . PHP_EOL;
based on IvLqn
Output for 7.0.5 - 7.2.0
1980-10-29T00:00:00+01:00 1980-10-30T00:00:00+01:00 Notice: Undefined variable: d1 in /in/ciQ5L on line 11 Fatal error: Uncaught Error: Call to a member function format() on null in /in/ciQ5L:11 Stack trace: #0 {main} thrown in /in/ciQ5L on line 11
Process exited with code 255.
Output for 7.0.0 - 7.0.4
1980-10-29T00:00:00+01:00 1980-10-30T00:00:00+01:00 Notice: Undefined variable: d1 in /in/ciQ5L on line 11 Fatal error: Uncaught Error: Call to a member function format() on unknown in /in/ciQ5L:11 Stack trace: #0 {main} thrown in /in/ciQ5L on line 11
Process exited with code 255.
Output for 5.6.8 - 5.6.28
1980-10-29T00:00:00+01:00 1980-10-30T00:00:00+01:00 Notice: Undefined variable: d1 in /in/ciQ5L on line 11 Fatal error: Call to a member function format() on null in /in/ciQ5L on line 11
Process exited with code 255.
Output for 5.5.24 - 5.5.35
1980-10-29T00:00:00+01:00 1980-10-30T00:00:00+01:00 Notice: Undefined variable: d1 in /in/ciQ5L on line 11 Fatal error: Call to a member function format() on a non-object in /in/ciQ5L on line 11
Process exited with code 255.
Output for 5.3.19 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/ciQ5L on line 3
Process exited with code 255.