3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $d = new \DateTime('2016-01-01T00:00:00+00:00'); $c = clone $d; $e = clone($d); echo $d->format('c'); echo "\n"; echo $c->modify('+1 day')->format('c'); echo "\n"; echo $e->modify('+1 day')->format('c'); echo "\n"; echo (clone $d)->modify('+1 day')->format('c'); echo "\n"; echo (clone($d))->modify('+1 day')->format('c'); echo "\n";
based on usQfh
Output for 7.0.0 - 7.2.0
2016-01-01T00:00:00+00:00 2016-01-02T00:00:00+00:00 2016-01-02T00:00:00+00:00 2016-01-02T00:00:00+00:00 2016-01-02T00:00:00+00:00
Output for 5.4.11 - 5.6.28
Parse error: syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ',' or ';' in /in/YigtF on line 11
Process exited with code 255.
Output for 5.3.21 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/YigtF on line 11
Process exited with code 255.