3v4l.org

run code in 300+ PHP versions simultaneously
<?php $interval_in_seconds = $settings['interval'] * 86400; $checkin_in_seconds = floor($checkin['timestamp'] / 1000); $next_checkin = $checkin_in_seconds + $interval_in_seconds; $until_next = $next_checkin - time(); if($until_next > 0) { $days = floor($until_next / 86400); function secondsToTime($seconds) { // Only here for var_dump testing: global $settings, $interval_in_seconds, $until_next, $next_checkin; $dtF = new DateTime("@0"); $dtT = new DateTime("@$seconds"); var_dump($until_next); $return = $dtF->diff($dtT)->format('%h hours, %i minutes and %s seconds'); var_dump($until_next); return $return; } $countdown = $days . ' days, ' . secondsToTime($until_next); } echo $countdown;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 29
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/RHb7d
function name:  (null)
number of ops:  31
compiled vars:  !0 = $interval_in_seconds, !1 = $settings, !2 = $checkin_in_seconds, !3 = $checkin, !4 = $next_checkin, !5 = $until_next, !6 = $days, !7 = $countdown
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_DIM_R                                      ~8      !1, 'interval'
          1        MUL                                              ~9      ~8, 86400
          2        ASSIGN                                                   !0, ~9
    4     3        INIT_FCALL                                               'floor'
          4        FETCH_DIM_R                                      ~11     !3, 'timestamp'
          5        DIV                                              ~12     ~11, 1000
          6        SEND_VAL                                                 ~12
          7        DO_ICALL                                         $13     
          8        ASSIGN                                                   !2, $13
    5     9        ADD                                              ~15     !2, !0
         10        ASSIGN                                                   !4, ~15
    6    11        INIT_FCALL                                               'time'
         12        DO_ICALL                                         $17     
         13        SUB                                              ~18     !4, $17
         14        ASSIGN                                                   !5, ~18
    8    15        IS_SMALLER                                               0, !5
         16      > JMPZ                                                     ~20, ->29
    9    17    >   INIT_FCALL                                               'floor'
         18        DIV                                              ~21     !5, 86400
         19        SEND_VAL                                                 ~21
         20        DO_ICALL                                         $22     
         21        ASSIGN                                                   !6, $22
   11    22        DECLARE_FUNCTION                                         'secondstotime'
   24    23        CONCAT                                           ~24     !6, '+days%2C+'
         24        INIT_FCALL_BY_NAME                                       'secondsToTime'
         25        SEND_VAR_EX                                              !5
         26        DO_FCALL                                      0  $25     
         27        CONCAT                                           ~26     ~24, $25
         28        ASSIGN                                                   !7, ~26
   27    29    >   ECHO                                                     !7
         30      > RETURN                                                   1

Function %00secondstotime%2Fin%2FRHb7d%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RHb7d
function name:  secondsToTime
number of ops:  30
compiled vars:  !0 = $seconds, !1 = $settings, !2 = $interval_in_seconds, !3 = $until_next, !4 = $next_checkin, !5 = $dtF, !6 = $dtT, !7 = $return
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        BIND_GLOBAL                                              !1, 'settings'
          2        BIND_GLOBAL                                              !2, 'interval_in_seconds'
          3        BIND_GLOBAL                                              !3, 'until_next'
          4        BIND_GLOBAL                                              !4, 'next_checkin'
   15     5        NEW                                              $8      'DateTime'
          6        SEND_VAL_EX                                              '%400'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !5, $8
   16     9        NEW                                              $11     'DateTime'
         10        NOP                                                      
         11        FAST_CONCAT                                      ~12     '%40', !0
         12        SEND_VAL_EX                                              ~12
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !6, $11
   18    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
   19    18        INIT_METHOD_CALL                                         !5, 'diff'
         19        SEND_VAR_EX                                              !6
         20        DO_FCALL                                      0  $16     
         21        INIT_METHOD_CALL                                         $16, 'format'
         22        SEND_VAL_EX                                              '%25h+hours%2C+%25i+minutes+and+%25s+seconds'
         23        DO_FCALL                                      0  $17     
         24        ASSIGN                                                   !7, $17
   20    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                                 
   22    28      > RETURN                                                   !7
   23    29*     > RETURN                                                   null

End of function %00secondstotime%2Fin%2FRHb7d%3A11%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.89 ms | 1400 KiB | 19 Q