3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $x = (new DateTimeImmutable('today')) ->setTimeZone(new DateTimeZone('UTC')) ->setTime(10, 10, 10); $y = clone $x; $y = $y ->setTimeZone(new DateTimeZone('Europe/Rome')) ->setTime(12, 10, 10); var_dump($x->format('U')); var_dump($y->format('U')); var_dump($x == $y);
based on 5fXUt
Output for 5.6.28, 7.0.20 - 7.2.0
string(10) "1444644610" string(10) "1444644610" bool(true)
Output for 7.0.6
string(10) "1462183810" string(10) "1462183810" bool(true)
Output for 7.0.5
string(10) "1459591810" string(10) "1459591810" bool(true)
Output for 7.0.4
string(10) "1457518210" string(10) "1457521810" bool(false)
Output for 7.0.3
string(10) "1458209410" string(10) "1458213010" bool(false)
Output for 7.0.2
string(10) "1458555010" string(10) "1458558610" bool(false)
Output for 7.0.1
string(10) "1458641410" string(10) "1458645010" bool(false)
Output for 7.0.0
string(10) "1458987010" string(10) "1458990610" bool(false)
Output for 5.6.21
string(10) "1462097410" string(10) "1462097410" bool(true)
Output for 5.6.20
string(10) "1460196610" string(10) "1460196610" bool(true)
Output for 5.6.19
string(10) "1457259010" string(10) "1457262610" bool(false)
Output for 5.6.18
string(10) "1457950210" string(10) "1457953810" bool(false)
Output for 5.6.17
string(10) "1458295810" string(10) "1458299410" bool(false)
Output for 5.6.16
string(10) "1459073410" string(10) "1459073410" bool(true)
Output for 5.6.15
string(10) "1459159810" string(10) "1459159810" bool(true)
Output for 5.6.14
string(10) "1459505410" string(10) "1459505410" bool(true)
Output for 5.6.13
string(10) "1460628610" string(10) "1460628610" bool(true)
Output for 5.6.12
string(10) "1460974210" string(10) "1460974210" bool(true)
Output for 5.6.11
string(10) "1461319810" string(10) "1461319810" bool(true)
Output for 5.6.10
string(10) "1461492610" string(10) "1461492610" bool(true)
Output for 5.6.9
string(10) "1461665410" string(10) "1461665410" bool(true)
Output for 5.6.8
string(10) "1461838210" string(10) "1461838210" bool(true)
Output for 5.5.35
string(10) "1463825410" string(10) "1463825410" bool(true)
Output for 5.5.34
string(10) "1460283010" string(10) "1460283010" bool(true)
Output for 5.5.33
string(10) "1457345410" string(10) "1457349010" bool(false)
Output for 5.5.32
string(10) "1458123010" string(10) "1458126610" bool(false)
Output for 5.5.31
string(10) "1458382210" string(10) "1458385810" bool(false)
Output for 5.5.30
string(10) "1459419010" string(10) "1459419010" bool(true)
Output for 5.5.29
string(10) "1460801410" string(10) "1460801410" bool(true)
Output for 5.5.28
string(10) "1461147010" string(10) "1461147010" bool(true)
Output for 5.5.27
string(10) "1461233410" string(10) "1461233410" bool(true)
Output for 5.5.26
string(10) "1461579010" string(10) "1461579010" bool(true)
Output for 5.5.25
string(10) "1461751810" string(10) "1461751810" bool(true)
Output for 5.5.24
string(10) "1463998210" string(10) "1463998210" bool(true)
Output for 5.4.2 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/AZRKB on line 3
Process exited with code 255.
Output for 5.3.18 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/AZRKB on line 4
Process exited with code 255.