3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $now = new \Datetime("UTC"); $lv = new \Datetime("America/Los_Angeles"); $interval = $now->diff($lv,true); print_r($lv); print_r($interval);
Output for 7.1.0
DateTime Object ( [date] => 2013-04-09 15:05:47.005445 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [f] => 2.8E-5 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.6.28, 7.0.14
DateTime Object ( [date] => 2013-04-09 15:05:47.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 7.0.6
DateTime Object ( [date] => 2016-05-02 16:11:29.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.5.34, 5.6.20, 7.0.5
DateTime Object ( [date] => 2016-04-12 11:00:11.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.5.32 - 5.5.33, 5.6.18 - 5.6.19, 7.0.4
DateTime Object ( [date] => 2016-04-12 11:00:12.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.5.31, 5.6.17, 7.0.1 - 7.0.3
DateTime Object ( [date] => 2016-04-12 11:00:13.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.6.14 - 5.6.16, 7.0.0
DateTime Object ( [date] => 2016-04-12 11:00:14.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for hhvm-3.12.0
DateTime Object ( [date] => 2016-04-12 20:00:12.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( )
Output for hhvm-3.10.0
DateTime Object ( [date] => 2016-04-12 20:00:14.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( )
Output for 5.6.21
DateTime Object ( [date] => 2016-05-01 11:16:08.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.45, 5.5.29 - 5.5.30, 5.6.13
DateTime Object ( [date] => 2016-04-12 11:00:15.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.44, 5.5.28, 5.6.11 - 5.6.12
DateTime Object ( [date] => 2016-04-12 11:00:17.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.41 - 5.4.43, 5.5.26 - 5.5.27, 5.6.9 - 5.6.10
DateTime Object ( [date] => 2016-04-12 11:00:18.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.40, 5.5.24 - 5.5.25, 5.6.7 - 5.6.8
DateTime Object ( [date] => 2016-04-12 11:00:19.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.37 - 5.4.39, 5.5.21 - 5.5.23, 5.6.6
DateTime Object ( [date] => 2016-04-12 11:00:20.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.35 - 5.4.36, 5.5.20, 5.6.4 - 5.6.5
DateTime Object ( [date] => 2016-04-12 11:00:21.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.34, 5.5.18 - 5.5.19, 5.6.0 - 5.6.3
DateTime Object ( [date] => 2016-04-12 11:00:22.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.5.35
DateTime Object ( [date] => 2016-05-21 14:25:18.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.31 - 5.4.32, 5.5.15 - 5.5.16
DateTime Object ( [date] => 2016-04-12 11:00:23.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.30, 5.5.14
DateTime Object ( [date] => 2016-04-12 11:00:24.000000 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.28 - 5.4.29, 5.5.12 - 5.5.13
DateTime Object ( [date] => 2016-04-12 11:00:24 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.25 - 5.4.27, 5.5.9 - 5.5.11
DateTime Object ( [date] => 2016-04-12 11:00:25 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.3.28, 5.4.23 - 5.4.24, 5.5.7 - 5.5.8
DateTime Object ( [date] => 2016-04-12 11:00:26 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.20 - 5.4.22, 5.5.4 - 5.5.6
DateTime Object ( [date] => 2016-04-12 11:00:27 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.3.27, 5.4.18 - 5.4.19, 5.5.1 - 5.5.3
DateTime Object ( [date] => 2016-04-12 11:00:28 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.4.17, 5.5.0
DateTime Object ( [date] => 2016-04-12 11:00:29 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.3.25 - 5.3.26, 5.4.14 - 5.4.16
DateTime Object ( [date] => 2016-04-12 11:00:29 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 0 )
Output for 5.3.21 - 5.3.24, 5.4.12 - 5.4.13
DateTime Object ( [date] => 2016-04-12 11:00:30 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 0 )
Output for 5.3.18 - 5.3.20, 5.4.9 - 5.4.11
DateTime Object ( [date] => 2016-04-12 11:00:31 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 0 )
Output for 5.3.15 - 5.3.17, 5.4.6 - 5.4.8
DateTime Object ( [date] => 2016-04-12 11:00:32 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 0 )
Output for 5.3.12 - 5.3.14, 5.4.3 - 5.4.5
DateTime Object ( [date] => 2016-04-12 11:00:33 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 0 )
Output for 5.3.9 - 5.3.11, 5.4.0 - 5.4.2
DateTime Object ( [date] => 2016-04-12 11:00:34 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 0 )
Output for 5.3.29
DateTime Object ( [date] => 2016-04-12 11:00:23 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [weekday] => 0 [weekday_behavior] => 0 [first_last_day_of] => 0 [invert] => 0 [days] => 0 [special_type] => 0 [special_amount] => 0 [have_weekday_relative] => 0 [have_special_relative] => 0 )
Output for 5.3.5 - 5.3.8
DateTime Object ( [date] => 2016-04-12 11:00:35 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 0 )
Output for 5.3.2 - 5.3.4
DateTime Object ( [date] => 2016-04-12 11:00:36 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 0 )
Output for 5.3.0 - 5.3.1
DateTime Object ( [date] => 2016-04-12 11:00:37 [timezone_type] => 3 [timezone] => America/Los_Angeles ) DateInterval Object ( [y] => 0 [m] => 0 [d] => 0 [h] => 0 [i] => 0 [s] => 0 [invert] => 0 [days] => 0 )
Output for 5.2.3 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8PZ8d on line 2 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/8PZ8d on line 3 Fatal error: Call to undefined method DateTime::diff() in /in/8PZ8d on line 5
Process exited with code 255.
Output for 5.2.0 - 5.2.2
<br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/8PZ8d</b> on line <b>2</b><br /> <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/8PZ8d</b> on line <b>3</b><br /> <br /> <b>Fatal error</b>: Call to undefined method DateTime::diff() in <b>/in/8PZ8d</b> on line <b>5</b><br />
Process exited with code 255.
Output for 5.0.0 - 5.1.6
<br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/8PZ8d</b> on line <b>2</b><br /> <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/8PZ8d</b> on line <b>3</b><br /> <br /> <b>Fatal error</b>: Class 'Datetime' not found in <b>/in/8PZ8d</b> on line <b>2</b><br />
Process exited with code 255.
Output for 4.3.2 - 4.4.9
<br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/8PZ8d</b> on line <b>2</b><br /> <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/8PZ8d</b> on line <b>3</b><br /> <br /> <b>Fatal error</b>: Cannot instantiate non-existent class: datetime in <b>/in/8PZ8d</b> on line <b>2</b><br />
Process exited with code 255.
Output for 4.3.0 - 4.3.1
<br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/8PZ8d</b> on line <b>2</b><br /> <br /> <b>Warning</b>: Unexpected character in input: '\' (ASCII=92) state=1 in <b>/in/8PZ8d</b> on line <b>3</b><br /> <br /> <b>Fatal error</b>: Cannot instantiate non-existent class: datetime in <b>/in/8PZ8d</b> on line <b>2</b><br />