3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $now = new DateTimeImmutable; $departure = $now->modify('+42 hours'); echo $now->format('Y-m-d H:i:s') . PHP_EOL; echo $departure->format('Y-m-d H:i:s') . PHP_EOL; echo $now->diff($departure)->format('%h') . PHP_EOL;
based on F86la
Output for 5.6.28, 7.0.20 - 7.2.0
2016-01-06 12:45:06 2016-01-08 06:45:06 18
Output for 7.0.6
2016-05-21 13:24:39 2016-05-23 07:24:39 18
Output for 7.0.5
2016-04-03 09:26:19 2016-04-05 03:26:19 18
Output for 7.0.4
2016-03-10 21:32:49 2016-03-12 15:32:49 18
Output for 7.0.3
2016-03-18 22:57:06 2016-03-20 16:57:06 18
Output for 7.0.2
2016-03-23 05:10:19 2016-03-24 23:10:19 18
Output for 7.0.1
2016-03-24 08:17:17 2016-03-26 02:17:17 18
Output for 7.0.0
2016-03-27 10:10:36 2016-03-29 04:10:36 18
Output for 5.6.21
2016-05-02 16:19:22 2016-05-04 10:19:22 18
Output for 5.6.20
2016-04-10 08:28:12 2016-04-12 02:28:12 18
Output for 5.6.19
2016-03-08 05:41:09 2016-03-09 23:41:09 18
Output for 5.6.18
2016-03-15 14:38:12 2016-03-17 08:38:12 18
Output for 5.6.17
2016-03-20 02:10:41 2016-03-21 20:10:41 18
Output for 5.6.16
2016-03-28 10:59:50 2016-03-30 04:59:50 18
Output for 5.6.15
2016-03-29 11:49:08 2016-03-31 05:49:08 18
Output for 5.6.14
2016-04-14 17:31:42 2016-04-16 11:31:42 18
Output for 5.6.13
2016-04-15 18:10:47 2016-04-17 12:10:47 18
Output for 5.6.12
2016-04-20 08:39:54 2016-04-22 02:39:54 18
Output for 5.6.11
2016-04-24 15:06:02 2016-04-26 09:06:02 18
Output for 5.6.10
2016-04-25 17:11:51 2016-04-27 11:11:51 18
Output for 5.6.9
2016-04-27 22:37:55 2016-04-29 16:37:55 18
Output for 5.6.8
2016-04-30 07:07:59 2016-05-02 01:07:59 18
Output for 5.5.35
2016-05-23 02:18:48 2016-05-24 20:18:48 18
Output for 5.5.34
2016-04-11 10:42:04 2016-04-13 04:42:04 18
Output for 5.5.33
2016-03-09 08:40:01 2016-03-11 02:40:01 18
Output for 5.5.32
2016-03-17 18:35:00 2016-03-19 12:35:00 18
Output for 5.5.31
2016-03-21 05:19:37 2016-03-22 23:19:37 18
Output for 5.5.30
2016-04-01 13:41:13 2016-04-03 07:41:13 18
Output for 5.5.29
2016-04-17 08:28:34 2016-04-19 02:28:34 18
Output for 5.5.28
2016-04-21 11:58:25 2016-04-23 05:58:25 18
Output for 5.5.27
2016-04-22 13:36:54 2016-04-24 07:36:54 18
Output for 5.5.26
2016-04-26 19:52:24 2016-04-28 13:52:24 18
Output for 5.5.25
2016-04-29 03:18:03 2016-04-30 21:18:03 18
Output for 5.5.24
2016-05-24 09:41:14 2016-05-26 03:41:14 18
Output for 5.3.21 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/lDkQl on line 2
Process exited with code 255.