3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo 'Forward transition:'.PHP_EOL; $dt = new DateTime('2018-03-25 1:30 Europe/Oslo'); $di = new DateInterval('P1D'); echo $dt->add($di)->format('c').PHP_EOL; $dt = new DateTime('2018-03-25 1:30 Europe/Oslo'); $di = new DateInterval('PT24H'); echo $dt->add($di)->format('c').PHP_EOL; $dt = new DateTime('2018-03-25 1:30 Europe/Oslo'); $di = new DateInterval('P1DT24H'); echo $dt->add($di)->format('c').PHP_EOL; echo PHP_EOL.'Backward transition:'.PHP_EOL; $dt = new DateTime('2018-10-28 1:30 Europe/Oslo'); $di = new DateInterval('P1D'); echo $dt->add($di)->format('c').PHP_EOL; $dt = new DateTime('2018-10-28 1:30 Europe/Oslo'); $di = new DateInterval('PT24H'); echo $dt->add($di)->format('c').PHP_EOL; $dt = new DateTime('2018-10-28 1:30 Europe/Oslo'); $di = new DateInterval('P1DT24H'); echo $dt->add($di)->format('c').PHP_EOL;
Output for 5.6.0 - 5.6.30, 7.1.0 - 7.3.0alpha1
Forward transition: 2018-03-26T01:30:00+02:00 2018-03-26T01:30:00+02:00 2018-03-27T01:30:00+02:00 Backward transition: 2018-10-29T01:30:00+01:00 2018-10-29T00:30:00+01:00 2018-10-30T01:30:00+01:00
Output for hhvm-3.18.5 - 3.22.0
Forward transition: 2018-03-26T01:30:00+02:00 2018-03-26T01:30:00+02:00 2018-03-27T01:30:00+02:00 Backward transition: 2018-10-29T01:30:00+01:00 2018-10-29T01:30:00+01:00 2018-10-30T01:30:00+01:00