3v4l.org

run code in 300+ PHP versions simultaneously
<?php function seconds_from_time($time) { list($h, $m, $s) = explode(':', $time); return ($h * 3600) + ($m * 60) + $s; } function time_from_seconds($seconds) { $h = floor($seconds / 3600); $m = floor(($seconds % 3600) / 60); $s = $seconds - ($h * 3600) - ($m * 60); return sprintf('%02d:%02d:%02d', $h, $m, $s); } echo seconds_from_time("18:27:31"); echo '<br />'; echo time_from_seconds(66451); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HBPVM
function name:  (null)
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'seconds_from_time'
          1        SEND_VAL                                                 '18%3A27%3A31'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   13     4        ECHO                                                     '%3Cbr+%2F%3E'
   14     5        INIT_FCALL                                               'time_from_seconds'
          6        SEND_VAL                                                 66451
          7        DO_FCALL                                      0  $1      
          8        ECHO                                                     $1
   16     9      > RETURN                                                   1

Function seconds_from_time:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HBPVM
function name:  seconds_from_time
number of ops:  18
compiled vars:  !0 = $time, !1 = $h, !2 = $m, !3 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%3A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        FETCH_LIST_R                                     $5      $4, 0
          6        ASSIGN                                                   !1, $5
          7        FETCH_LIST_R                                     $7      $4, 1
          8        ASSIGN                                                   !2, $7
          9        FETCH_LIST_R                                     $9      $4, 2
         10        ASSIGN                                                   !3, $9
         11        FREE                                                     $4
    4    12        MUL                                              ~11     !1, 3600
         13        MUL                                              ~12     !2, 60
         14        ADD                                              ~13     ~11, ~12
         15        ADD                                              ~14     ~13, !3
         16      > RETURN                                                   ~14
    5    17*     > RETURN                                                   null

End of function seconds_from_time

Function time_from_seconds:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HBPVM
function name:  time_from_seconds
number of ops:  25
compiled vars:  !0 = $seconds, !1 = $h, !2 = $m, !3 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'floor'
          2        DIV                                              ~4      !0, 3600
          3        SEND_VAL                                                 ~4
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
    8     6        INIT_FCALL                                               'floor'
          7        MOD                                              ~7      !0, 3600
          8        DIV                                              ~8      ~7, 60
          9        SEND_VAL                                                 ~8
         10        DO_ICALL                                         $9      
         11        ASSIGN                                                   !2, $9
    9    12        MUL                                              ~11     !1, 3600
         13        SUB                                              ~12     !0, ~11
         14        MUL                                              ~13     !2, 60
         15        SUB                                              ~14     ~12, ~13
         16        ASSIGN                                                   !3, ~14
   10    17        INIT_FCALL                                               'sprintf'
         18        SEND_VAL                                                 '%2502d%3A%2502d%3A%2502d'
         19        SEND_VAR                                                 !1
         20        SEND_VAR                                                 !2
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $16     
         23      > RETURN                                                   $16
   11    24*     > RETURN                                                   null

End of function time_from_seconds

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.93 ms | 1403 KiB | 21 Q