3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function check($dateAdded,$now){ $secondsInPast = $now->getTimestamp() - $dateAdded->getTimestamp(); if($secondsInPast > 60*60*2){ echo $dateAdded->format('H:i:s'). " Old enough\n"; } else { echo $dateAdded->format('H:i:s'). " Not Old Enough\n"; } } $now = new Datetime('now'); echo "Now:" . $now->format('H:i:s')."\n\n"; check(new DateTime('- 13 seconds'),$now); check(new DateTime('- 13 minutes'),$now); check(new DateTime('- 100 minutes'),$now); check(new DateTime('- 125 minutes'),$now);
based on cbNFZ
Output for 5.6.28, 7.0.14 - 7.1.0
Now:18:10:00 18:09:47 Not Old Enough 17:57:00 Not Old Enough 16:30:00 Not Old Enough 16:05:00 Old enough
Output for 7.0.6
Now:10:27:00 10:26:47 Not Old Enough 10:14:00 Not Old Enough 08:47:00 Not Old Enough 08:22:00 Old enough
Output for 7.0.5
Now:23:12:51 23:12:38 Not Old Enough 22:59:51 Not Old Enough 21:32:51 Not Old Enough 21:07:51 Old enough
Output for 7.0.4
Now:09:49:30 09:49:17 Not Old Enough 09:36:30 Not Old Enough 08:09:30 Not Old Enough 07:44:30 Old enough
Output for 7.0.3
Now:10:29:33 10:29:20 Not Old Enough 10:16:33 Not Old Enough 08:49:33 Not Old Enough 08:24:33 Old enough
Output for 7.0.2
Now:16:28:04 16:27:51 Not Old Enough 16:15:04 Not Old Enough 14:48:04 Not Old Enough 14:23:04 Old enough
Output for 7.0.1
Now:21:03:12 21:02:59 Not Old Enough 20:50:12 Not Old Enough 19:23:12 Not Old Enough 18:58:12 Old enough
Output for 7.0.0
Now:22:35:28 22:35:15 Not Old Enough 22:22:28 Not Old Enough 20:55:28 Not Old Enough 20:30:28 Old enough
Output for hhvm-3.12.0
Now:13:15:33 13:15:20 Not Old Enough 13:02:33 Not Old Enough 11:35:33 Not Old Enough 11:10:33 Old enough
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.21
Now:05:46:20 05:46:07 Not Old Enough 05:33:20 Not Old Enough 04:06:20 Not Old Enough 03:41:20 Old enough
Output for 5.6.20
Now:22:12:32 22:12:19 Not Old Enough 21:59:32 Not Old Enough 20:32:32 Not Old Enough 20:07:32 Old enough
Output for 5.6.19
Now:17:56:50 17:56:37 Not Old Enough 17:43:50 Not Old Enough 16:16:50 Not Old Enough 15:51:50 Old enough
Output for 5.6.18
Now:02:03:37 02:03:24 Not Old Enough 01:50:37 Not Old Enough 00:23:37 Not Old Enough 23:58:37 Old enough
Output for 5.6.17
Now:14:43:08 14:42:55 Not Old Enough 14:30:08 Not Old Enough 13:03:08 Not Old Enough 12:38:08 Old enough
Output for 5.6.16
Now:00:32:37 00:32:24 Not Old Enough 00:19:37 Not Old Enough 22:52:37 Not Old Enough 22:27:37 Old enough
Output for 5.6.15
Now:01:27:55 01:27:42 Not Old Enough 01:14:55 Not Old Enough 23:47:55 Not Old Enough 23:22:55 Old enough
Output for 5.6.14
Now:03:46:49 03:46:36 Not Old Enough 03:33:49 Not Old Enough 02:06:49 Not Old Enough 01:41:49 Old enough
Output for 5.6.13
Now:07:41:15 07:41:02 Not Old Enough 07:28:15 Not Old Enough 06:01:15 Not Old Enough 05:36:15 Old enough
Output for 5.6.12
Now:21:29:43 21:29:30 Not Old Enough 21:16:43 Not Old Enough 19:49:43 Not Old Enough 19:24:43 Old enough
Output for 5.6.11
Now:04:31:41 04:31:28 Not Old Enough 04:18:41 Not Old Enough 02:51:41 Not Old Enough 02:26:41 Old enough
Output for 5.6.10
Now:06:16:24 06:16:11 Not Old Enough 06:03:24 Not Old Enough 04:36:24 Not Old Enough 04:11:24 Old enough
Output for 5.6.9
Now:11:15:23 11:15:10 Not Old Enough 11:02:23 Not Old Enough 09:35:23 Not Old Enough 09:10:23 Old enough
Output for 5.6.8
Now:19:24:06 19:23:53 Not Old Enough 19:11:06 Not Old Enough 17:44:06 Not Old Enough 17:19:06 Old enough
Output for 5.5.35
Now:09:34:05 09:33:52 Not Old Enough 09:21:05 Not Old Enough 07:54:05 Not Old Enough 07:29:05 Old enough
Output for 5.5.34
Now:00:32:49 00:32:36 Not Old Enough 00:19:49 Not Old Enough 22:52:49 Not Old Enough 22:27:49 Old enough
Output for 5.5.33
Now:20:53:45 20:53:32 Not Old Enough 20:40:45 Not Old Enough 19:13:45 Not Old Enough 18:48:45 Old enough
Output for 5.5.32
Now:03:37:05 03:36:52 Not Old Enough 03:24:05 Not Old Enough 01:57:05 Not Old Enough 01:32:05 Old enough
Output for 5.5.31
Now:17:28:19 17:28:06 Not Old Enough 17:15:19 Not Old Enough 15:48:19 Not Old Enough 15:23:19 Old enough
Output for 5.5.30
Now:03:24:40 03:24:27 Not Old Enough 03:11:40 Not Old Enough 01:44:40 Not Old Enough 01:19:40 Old enough
Output for 5.5.29
Now:21:48:31 21:48:18 Not Old Enough 21:35:31 Not Old Enough 20:08:31 Not Old Enough 19:43:31 Old enough
Output for 5.5.28
Now:00:45:56 00:45:43 Not Old Enough 00:32:56 Not Old Enough 23:05:56 Not Old Enough 22:40:56 Old enough
Output for 5.5.27
Now:03:03:39 03:03:26 Not Old Enough 02:50:39 Not Old Enough 01:23:39 Not Old Enough 00:58:39 Old enough
Output for 5.5.26
Now:08:43:11 08:42:58 Not Old Enough 08:30:11 Not Old Enough 07:03:11 Not Old Enough 06:38:11 Old enough
Output for 5.5.25
Now:15:01:46 15:01:33 Not Old Enough 14:48:46 Not Old Enough 13:21:46 Not Old Enough 12:56:46 Old enough
Output for 5.5.24
Now:22:22:03 22:21:50 Not Old Enough 22:09:03 Not Old Enough 20:42:03 Not Old Enough 20:17:03 Old enough
Output for 5.4.45
Now:15:03:59 15:03:46 Not Old Enough 14:50:59 Not Old Enough 13:23:59 Not Old Enough 12:58:59 Old enough
Output for 5.4.44
Now:15:03:54 15:03:41 Not Old Enough 14:50:54 Not Old Enough 13:23:54 Not Old Enough 12:58:54 Old enough
Output for 5.4.43
Now:15:03:49 15:03:36 Not Old Enough 14:50:49 Not Old Enough 13:23:49 Not Old Enough 12:58:49 Old enough
Output for 5.4.42
Now:09:29:33 09:29:20 Not Old Enough 09:16:33 Not Old Enough 07:49:33 Not Old Enough 07:24:33 Old enough
Output for 5.4.41
Now:09:29:31 09:29:18 Not Old Enough 09:16:31 Not Old Enough 07:49:31 Not Old Enough 07:24:31 Old enough
Output for 5.4.40
Now:09:29:27 09:29:14 Not Old Enough 09:16:27 Not Old Enough 07:49:27 Not Old Enough 07:24:27 Old enough
Output for 5.4.39
Now:09:29:26 09:29:13 Not Old Enough 09:16:26 Not Old Enough 07:49:26 Not Old Enough 07:24:26 Old enough
Output for 5.4.38
Now:09:29:25 09:29:12 Not Old Enough 09:16:25 Not Old Enough 07:49:25 Not Old Enough 07:24:25 Old enough
Output for 5.4.35 - 5.4.37
Now:09:29:22 09:29:09 Not Old Enough 09:16:22 Not Old Enough 07:49:22 Not Old Enough 07:24:22 Old enough
Output for 5.4.34
Now:09:29:21 09:29:08 Not Old Enough 09:16:21 Not Old Enough 07:49:21 Not Old Enough 07:24:21 Old enough
Output for 5.4.28 - 5.4.32
Now:18:10:05 18:09:52 Not Old Enough 17:57:05 Not Old Enough 16:30:05 Not Old Enough 16:05:05 Old enough
Output for 5.4.10 - 5.4.27
Now:18:10:06 18:09:53 Not Old Enough 17:57:06 Not Old Enough 16:30:06 Not Old Enough 16:05:06 Old enough
Output for 5.3.20 - 5.4.9
Now:18:10:07 18:09:54 Not Old Enough 17:57:07 Not Old Enough 16:30:07 Not Old Enough 16:05:07 Old enough
Output for 5.3.0 - 5.3.19
Now:18:10:08 18:09:55 Not Old Enough 17:57:08 Not Old Enough 16:30:08 Not Old Enough 16:05:08 Old enough
Output for 5.2.0 - 5.2.17
Now:18:10:09 Fatal error: Call to undefined method DateTime::getTimestamp() in /in/hggYR on line 3
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'Datetime' not found in /in/hggYR on line 10
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/hggYR on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/hggYR on line 10