3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $now = new \Datetime("UTC"); $lv = new \Datetime("America/Los_Angeles"); $interval = $lv->diff($now,true); print_r($lv);
Output for 7.2.6
DateTime Object ( [date] => 2013-04-09 15:03:39.004766 [timezone_type] => 3 [timezone] => America/Los_Angeles )
Output for 7.2.0
DateTime Object ( [date] => 2013-04-09 15:03:39.004515 [timezone_type] => 3 [timezone] => America/Los_Angeles )
Output for 7.1.20
DateTime Object ( [date] => 2013-04-09 15:03:39.002515 [timezone_type] => 3 [timezone] => America/Los_Angeles )
Output for 7.1.10
DateTime Object ( [date] => 2013-04-09 15:03:39.003751 [timezone_type] => 3 [timezone] => America/Los_Angeles )
Output for 7.1.7
DateTime Object ( [date] => 2013-04-09 15:03:39.004082 [timezone_type] => 3 [timezone] => America/Los_Angeles )
Output for 7.1.6
DateTime Object ( [date] => 2013-04-09 15:03:39.010643 [timezone_type] => 3 [timezone] => America/Los_Angeles )
Output for 7.1.5
DateTime Object ( [date] => 2013-04-09 15:03:39.005876 [timezone_type] => 3 [timezone] => America/Los_Angeles )
Output for 7.1.0
DateTime Object ( [date] => 2013-04-09 15:03:39.006412 [timezone_type] => 3 [timezone] => America/Los_Angeles )
Output for 5.4.30 - 5.4.45, 5.5.14 - 7.0.20
DateTime Object ( [date] => 2013-04-09 15:03:39.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles )
Output for 5.3.0 - 5.4.29, 5.5.0 - 5.5.13
DateTime Object ( [date] => 2013-04-09 15:03:39 [timezone_type] => 3 [timezone] => America/Los_Angeles )
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XXBGQ on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XXBGQ on line 3 Fatal error: Call to undefined method DateTime::diff() in /in/XXBGQ on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XXBGQ on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XXBGQ on line 3 Fatal error: Class 'Datetime' not found in /in/XXBGQ on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XXBGQ on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XXBGQ on line 3 Fatal error: Cannot instantiate non-existent class: datetime in /in/XXBGQ on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XXBGQ on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/XXBGQ on line 3 Fatal error: Cannot instantiate non-existent class: datetime in /in/XXBGQ on line 2