3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace DrummondCentral\Bender\Command; class Command {} namespace Commands; use DrummondCentral\Bender\Command\Command; class HometimeCommand extends Command { public static function getCommand() { return 'hometime'; } public static function getDescription() { return 'Displays the number of hours and minutes until home time.'; } public function handle($message) { date_default_timezone_set('Europe/London'); $workend = strtotime('17:30'); $diff = $workend - time(); $hometime = gmdate("H:i:s", $diff); if (time() === $workend) { return 'It\'s home time! Rejoice!'; } return "Home time is in " . $hometime . "."; } } $command = new HometimeCommand(); var_dump($command->handle(''));
Output for 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.30, 7.4.0 - 7.4.24, 8.0.0 - 8.0.11
string(25) "Home time is in 21:11:11."
Output for 7.0.6
string(25) "Home time is in 23:36:37."
Output for 7.0.5
string(25) "Home time is in 11:12:22."
Output for 7.0.4
string(25) "Home time is in 23:23:01."
Output for 7.0.3
string(25) "Home time is in 22:10:42."
Output for 7.0.2
string(25) "Home time is in 16:03:19."
Output for 7.0.1
string(25) "Home time is in 12:29:21."
Output for 7.0.0
string(25) "Home time is in 10:33:39."
Output for 5.6.21
string(25) "Home time is in 04:27:41."
Output for 5.6.20
string(25) "Home time is in 12:12:53."
Output for 5.6.19
string(25) "Home time is in 15:12:02."
Output for 5.6.18
string(25) "Home time is in 06:25:29."
Output for 5.6.17
string(25) "Home time is in 18:49:02."
Output for 5.6.16
string(25) "Home time is in 09:46:17."
Output for 5.6.15
string(25) "Home time is in 08:55:44."
Output for 5.6.14
string(25) "Home time is in 07:05:50."
Output for 5.6.13
string(25) "Home time is in 02:37:50."
Output for 5.6.12
string(25) "Home time is in 12:09:48."
Output for 5.6.11
string(25) "Home time is in 05:46:29."
Output for 5.6.10
string(25) "Home time is in 03:44:18."
Output for 5.6.9
string(25) "Home time is in 22:34:24."
Output for 5.6.8
string(25) "Home time is in 13:41:25."
Output for 5.5.35
string(25) "Home time is in 20:27:29."
Output for 5.5.34
string(25) "Home time is in 10:01:24."
Output for 5.5.33
string(25) "Home time is in 12:25:31."
Output for 5.5.32
string(25) "Home time is in 02:33:23."
Output for 5.5.31
string(25) "Home time is in 15:45:44."
Output for 5.5.30
string(25) "Home time is in 07:01:55."
Output for 5.5.29
string(25) "Home time is in 12:16:28."
Output for 5.5.28
string(25) "Home time is in 08:55:28."
Output for 5.5.27
string(25) "Home time is in 07:09:59."
Output for 5.5.26
string(25) "Home time is in 01:01:15."
Output for 5.5.25
string(25) "Home time is in 18:04:54."
Output for 5.5.24
string(25) "Home time is in 11:36:17."

preferences:
112.87 ms | 401 KiB | 127 Q