3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $eet = new DateTimeZone('EET'); $msk = new DateTimeZone('Europe/Moscow'); $d = (new DateTime('now', $msk))->setTimezone($eet); $d1 = clone $d; $d->setTimezone($msk); var_dump($d, $d1);
Output for 7.2.0
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 17:51:31.003694" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:51:31.003694" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 7.1.10
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 17:51:31.099487" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:51:31.099487" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 7.1.7
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 17:51:31.003901" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:51:31.003901" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 7.1.6
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 17:51:31.013914" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:51:31.013914" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 7.1.5
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 17:51:31.011035" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:51:31.011035" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 7.1.0
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 19:51:31.004039" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:51:31.004039" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 7.0.20
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 17:51:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:51:31.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 5.5.18 - 5.6.23, 7.0.0 - 7.0.8
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 19:26:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:26:26.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 5.6.28
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 19:51:31.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:51:31.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 5.5.14 - 5.5.16
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 20:26:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:26:26.000000" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 5.5.10 - 5.5.13
object(DateTime)#3 (3) { ["date"]=> string(19) "2015-11-06 20:26:26" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(19) "2015-11-06 16:26:26" ["timezone_type"]=> int(2) ["timezone"]=> string(3) "EET" }
Output for 5.4.0 - 5.4.29, 5.5.0 - 5.5.9
object(DateTime)#3 (3) { ["date"]=> string(19) "2015-11-06 18:26:26" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(19) "2015-11-06 16:26:26" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.34 - 5.4.45
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 17:26:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:26:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.31 - 5.4.32
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 18:26:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:26:26.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 5.4.30
object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-06 18:26:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Moscow" } object(DateTime)#4 (3) { ["date"]=> string(26) "2015-11-06 16:26:27.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(15) "Europe/Helsinki" }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/JW2Ot on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/JW2Ot on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/JW2Ot on line 5
Process exited with code 255.