3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Commands; class HometimeCommand { 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());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8ianp
function name:  (null)
number of ops:  9
compiled vars:  !0 = $command
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   NEW                                              $1      'Commands%5CHometimeCommand'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   36     3        INIT_NS_FCALL_BY_NAME                                    'Commands%5Cvar_dump'
          4        INIT_METHOD_CALL                                         !0, 'handle'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR_NO_REF_EX                                       $4
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class Commands\HometimeCommand:
Function getcommand:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8ianp
function name:  getCommand
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E > > RETURN                                                   'hometime'
   10     1*     > RETURN                                                   null

End of function getcommand

Function getdescription:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8ianp
function name:  getDescription
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   'Displays+the+number+of+hours+and+minutes+until+home+time.'
   15     1*     > RETURN                                                   null

End of function getdescription

Function handle:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 22
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8ianp
function name:  handle
number of ops:  26
compiled vars:  !0 = $message, !1 = $workend, !2 = $diff, !3 = $hometime
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        INIT_NS_FCALL_BY_NAME                                    'Commands%5Cdate_default_timezone_set'
          2        SEND_VAL_EX                                              'Europe%2FLondon'
          3        DO_FCALL                                      0          
   21     4        INIT_NS_FCALL_BY_NAME                                    'Commands%5Cstrtotime'
          5        SEND_VAL_EX                                              '17%3A30'
          6        DO_FCALL                                      0  $5      
          7        ASSIGN                                                   !1, $5
   23     8        INIT_NS_FCALL_BY_NAME                                    'Commands%5Ctime'
          9        DO_FCALL                                      0  $7      
         10        SUB                                              ~8      !1, $7
         11        ASSIGN                                                   !2, ~8
   25    12        INIT_NS_FCALL_BY_NAME                                    'Commands%5Cgmdate'
         13        SEND_VAL_EX                                              'H%3Ai%3As'
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0  $10     
         16        ASSIGN                                                   !3, $10
   27    17        INIT_NS_FCALL_BY_NAME                                    'Commands%5Ctime'
         18        DO_FCALL                                      0  $12     
         19        IS_IDENTICAL                                             !1, $12
         20      > JMPZ                                                     ~13, ->22
   28    21    > > RETURN                                                   'It%27s+home+time%21+Rejoice%21'
   31    22    >   CONCAT                                           ~14     'Home+time+is+in+', !3
         23        CONCAT                                           ~15     ~14, '.'
         24      > RETURN                                                   ~15
   32    25*     > RETURN                                                   null

End of function handle

End of class Commands\HometimeCommand.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.74 ms | 1400 KiB | 23 Q