3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function check($dateAdded,$now){ $secondsTillOldEnough = 60*60*2; $secondsInPast = $now->getTimestamp() - $dateAdded->getTimestamp(); $seconds = $secondsTillOldEnough - $secondsInPast; if($secondsInPast > $secondsTillOldEnough){ echo $dateAdded->format('H:i:s'). " Old enough $seconds\n"; } else { echo $dateAdded->format('H:i:s'). " Not Old Enough $seconds\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 0uVaH
Output for 5.6.28, 7.0.14 - 7.1.0
Now:18:51:49 18:51:36 Not Old Enough 7187 18:38:49 Not Old Enough 6420 17:11:49 Not Old Enough 1200 16:46:49 Old enough -300
Output for 7.0.7
Now:20:51:49 20:51:36 Not Old Enough 7187 20:38:49 Not Old Enough 6420 19:11:49 Not Old Enough 1200 18:46:49 Old enough -300
Output for 7.0.6
Now:23:23:47 23:23:34 Not Old Enough 7187 23:10:47 Not Old Enough 6420 21:43:47 Not Old Enough 1200 21:18:47 Old enough -300
Output for 7.0.5
Now:12:57:47 12:57:34 Not Old Enough 7187 12:44:47 Not Old Enough 6420 11:17:47 Not Old Enough 1200 10:52:47 Old enough -300
Output for 7.0.4
Now:21:47:09 21:46:56 Not Old Enough 7187 21:34:09 Not Old Enough 6420 20:07:09 Not Old Enough 1200 19:42:09 Old enough -300
Output for 7.0.3
Now:22:11:35 22:11:22 Not Old Enough 7187 21:58:35 Not Old Enough 6420 20:31:35 Not Old Enough 1200 20:06:35 Old enough -300
Output for 7.0.2
Now:08:56:34 08:56:21 Not Old Enough 7187 08:43:34 Not Old Enough 6420 07:16:34 Not Old Enough 1200 06:51:34 Old enough -300
Output for 7.0.1
Now:08:34:56 08:34:43 Not Old Enough 7187 08:21:56 Not Old Enough 6420 06:54:56 Not Old Enough 1200 06:29:56 Old enough -300
Output for 7.0.0
Now:11:48:04 11:47:51 Not Old Enough 7187 11:35:04 Not Old Enough 6420 10:08:04 Not Old Enough 1200 09:43:04 Old enough -300
Output for hhvm-3.12.0
Now:00:55:09 00:54:56 Not Old Enough 7187 00:42:09 Not Old Enough 6420 23:15:09 Not Old Enough 1200 22:50:09 Old enough -300
Output for hhvm-3.10.0
Now:15:19:01 15:18:48 Not Old Enough 7187 15:06:01 Not Old Enough 6420 13:39:01 Not Old Enough 1200 13:14:01 Old enough -300
Output for 5.6.21
Now:18:28:36 18:28:23 Not Old Enough 7187 18:15:36 Not Old Enough 6420 16:48:36 Not Old Enough 1200 16:23:36 Old enough -300
Output for 5.6.20
Now:08:17:01 08:16:48 Not Old Enough 7187 08:04:01 Not Old Enough 6420 06:37:01 Not Old Enough 1200 06:12:01 Old enough -300
Output for 5.6.19
Now:18:45:03 18:44:50 Not Old Enough 7187 18:32:03 Not Old Enough 6420 17:05:03 Not Old Enough 1200 16:40:03 Old enough -300
Output for 5.6.18
Now:07:11:39 07:11:26 Not Old Enough 7187 06:58:39 Not Old Enough 6420 05:31:39 Not Old Enough 1200 05:06:39 Old enough -300
Output for 5.6.17
Now:02:45:15 02:45:02 Not Old Enough 7187 02:32:15 Not Old Enough 6420 01:05:15 Not Old Enough 1200 00:40:15 Old enough -300
Output for 5.6.16
Now:13:30:25 13:30:12 Not Old Enough 7187 13:17:25 Not Old Enough 6420 11:50:25 Not Old Enough 1200 11:25:25 Old enough -300
Output for 5.6.15
Now:14:20:34 14:20:21 Not Old Enough 7187 14:07:34 Not Old Enough 6420 12:40:34 Not Old Enough 1200 12:15:34 Old enough -300
Output for 5.6.14
Now:17:14:21 17:14:08 Not Old Enough 7187 17:01:21 Not Old Enough 6420 15:34:21 Not Old Enough 1200 15:09:21 Old enough -300
Output for 5.6.13
Now:21:10:59 21:10:46 Not Old Enough 7187 20:57:59 Not Old Enough 6420 19:30:59 Not Old Enough 1200 19:05:59 Old enough -300
Output for 5.6.12
Now:10:10:20 10:10:07 Not Old Enough 7187 09:57:20 Not Old Enough 6420 08:30:20 Not Old Enough 1200 08:05:20 Old enough -300
Output for 5.6.11
Now:17:31:44 17:31:31 Not Old Enough 7187 17:18:44 Not Old Enough 6420 15:51:44 Not Old Enough 1200 15:26:44 Old enough -300
Output for 5.6.10
Now:19:09:04 19:08:51 Not Old Enough 7187 18:56:04 Not Old Enough 6420 17:29:04 Not Old Enough 1200 17:04:04 Old enough -300
Output for 5.6.9
Now:00:05:19 00:05:06 Not Old Enough 7187 23:52:19 Not Old Enough 6420 22:25:19 Not Old Enough 1200 22:00:19 Old enough -300
Output for 5.6.8
Now:07:44:27 07:44:14 Not Old Enough 7187 07:31:27 Not Old Enough 6420 06:04:27 Not Old Enough 1200 05:39:27 Old enough -300
Output for 5.6.7
Now:17:15:13 17:15:00 Not Old Enough 7187 17:02:13 Not Old Enough 6420 15:35:13 Not Old Enough 1200 15:10:13 Old enough -300
Output for 5.5.35
Now:21:35:22 21:35:09 Not Old Enough 7187 21:22:22 Not Old Enough 6420 19:55:22 Not Old Enough 1200 19:30:22 Old enough -300
Output for 5.5.34
Now:13:41:10 13:40:57 Not Old Enough 7187 13:28:10 Not Old Enough 6420 12:01:10 Not Old Enough 1200 11:36:10 Old enough -300
Output for 5.5.33
Now:08:55:14 08:55:01 Not Old Enough 7187 08:42:14 Not Old Enough 6420 07:15:14 Not Old Enough 1200 06:50:14 Old enough -300
Output for 5.5.32
Now:18:00:33 18:00:20 Not Old Enough 7187 17:47:33 Not Old Enough 6420 16:20:33 Not Old Enough 1200 15:55:33 Old enough -300
Output for 5.5.31
Now:05:42:50 05:42:37 Not Old Enough 7187 05:29:50 Not Old Enough 6420 04:02:50 Not Old Enough 1200 03:37:50 Old enough -300
Output for 5.5.30
Now:16:33:21 16:33:08 Not Old Enough 7187 16:20:21 Not Old Enough 6420 14:53:21 Not Old Enough 1200 14:28:21 Old enough -300
Output for 5.5.29
Now:11:01:18 11:01:05 Not Old Enough 7187 10:48:18 Not Old Enough 6420 09:21:18 Not Old Enough 1200 08:56:18 Old enough -300
Output for 5.5.28
Now:13:13:38 13:13:25 Not Old Enough 7187 13:00:38 Not Old Enough 6420 11:33:38 Not Old Enough 1200 11:08:38 Old enough -300
Output for 5.5.27
Now:16:01:25 16:01:12 Not Old Enough 7187 15:48:25 Not Old Enough 6420 14:21:25 Not Old Enough 1200 13:56:25 Old enough -300
Output for 5.5.26
Now:21:21:48 21:21:35 Not Old Enough 7187 21:08:48 Not Old Enough 6420 19:41:48 Not Old Enough 1200 19:16:48 Old enough -300
Output for 5.5.25
Now:03:25:55 03:25:42 Not Old Enough 7187 03:12:55 Not Old Enough 6420 01:45:55 Not Old Enough 1200 01:20:55 Old enough -300
Output for 5.5.24
Now:11:11:49 11:11:36 Not Old Enough 7187 10:58:49 Not Old Enough 6420 09:31:49 Not Old Enough 1200 09:06:49 Old enough -300
Output for 5.4.45
Now:15:04:09 15:03:56 Not Old Enough 7187 14:51:09 Not Old Enough 6420 13:24:09 Not Old Enough 1200 12:59:09 Old enough -300
Output for 5.4.44
Now:15:04:04 15:03:51 Not Old Enough 7187 14:51:04 Not Old Enough 6420 13:24:04 Not Old Enough 1200 12:59:04 Old enough -300
Output for 5.4.43
Now:15:03:59 15:03:46 Not Old Enough 7187 14:50:59 Not Old Enough 6420 13:23:59 Not Old Enough 1200 12:58:59 Old enough -300
Output for 5.4.42
Now:09:31:23 09:31:10 Not Old Enough 7187 09:18:23 Not Old Enough 6420 07:51:23 Not Old Enough 1200 07:26:23 Old enough -300
Output for 5.4.41
Now:09:31:21 09:31:08 Not Old Enough 7187 09:18:21 Not Old Enough 6420 07:51:21 Not Old Enough 1200 07:26:21 Old enough -300
Output for 5.4.39 - 5.4.40
Now:09:31:17 09:31:04 Not Old Enough 7187 09:18:17 Not Old Enough 6420 07:51:17 Not Old Enough 1200 07:26:17 Old enough -300
Output for 5.4.38
Now:09:31:15 09:31:02 Not Old Enough 7187 09:18:15 Not Old Enough 6420 07:51:15 Not Old Enough 1200 07:26:15 Old enough -300
Output for 5.4.35 - 5.4.37
Now:09:31:13 09:31:00 Not Old Enough 7187 09:18:13 Not Old Enough 6420 07:51:13 Not Old Enough 1200 07:26:13 Old enough -300
Output for 5.4.34
Now:09:31:12 09:30:59 Not Old Enough 7187 09:18:12 Not Old Enough 6420 07:51:12 Not Old Enough 1200 07:26:12 Old enough -300
Output for 5.4.32
Now:18:51:54 18:51:41 Not Old Enough 7187 18:38:54 Not Old Enough 6420 17:11:54 Not Old Enough 1200 16:46:54 Old enough -300
Output for 5.4.12 - 5.4.31
Now:18:51:55 18:51:42 Not Old Enough 7187 18:38:55 Not Old Enough 6420 17:11:55 Not Old Enough 1200 16:46:55 Old enough -300
Output for 5.3.21 - 5.4.11
Now:18:51:56 18:51:43 Not Old Enough 7187 18:38:56 Not Old Enough 6420 17:11:56 Not Old Enough 1200 16:46:56 Old enough -300
Output for 5.3.1 - 5.3.20
Now:18:51:57 18:51:44 Not Old Enough 7187 18:38:57 Not Old Enough 6420 17:11:57 Not Old Enough 1200 16:46:57 Old enough -300
Output for 5.3.0
Now:18:51:58 18:51:45 Not Old Enough 7187 18:38:58 Not Old Enough 6420 17:11:58 Not Old Enough 1200 16:46:58 Old enough -300
Output for 5.2.0 - 5.2.17
Now:18:51:58 Fatal error: Call to undefined method DateTime::getTimestamp() in /in/UeYlg on line 4
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'Datetime' not found in /in/UeYlg on line 12
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/UeYlg on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/UeYlg on line 12