3v4l.org

run code in 300+ PHP versions simultaneously
<?php function tipoHorario($hora, $inicioMatutino, $inicioVespertino, $finMatutino, $finVespertino){ $horaUTC = strtotime($hora); if($horaUTC >= strtotime($inicioMatutino) && $horaUTC < strtotime($finMatutino)) return "Matutino"; else if($horaUTC >= strtotime($finMatutino) && $horaUTC < strtotime($inicioVespertino) ) return "Descanso matutino"; else if($horaUTC >= strtotime($inicioVespertino) && $horaUTC < strtotime($finVespertino)) return "Vespertino"; else return "Descanso vespertino"; } function casoEspecialMatutino($hora, $finMatutino){ $previoFinMatutino = date("H:i", strtotime($previoFinMatutino . " -30 minutes")); echo $previoFinMatutino; } function casoEspecialVespertino($hora, $finVespertino){ } function checktime($fechaHora, $minutosTolerancia){ $fecha = date("Y-m-d", strtotime($fechaHora)); $horaMinuto = date("H:i", strtotime($fechaHora)); $noDia = date("N", strtotime($fechaHora)); $horaInicioMatutino = "09:00"; $horaFinMatutino = "15:00"; $horaInicioVespertino = "16:30"; $horaFinVespertino = "18:30"; /*echo "fecha: " . $fecha . "\nhoraMinuto: " . $horaMinuto . "\nnoDia: " . $noDia; echo tipoHorario($horaMinuto, $horaInicioMatutino, $horaInicioVespertino, $horaFinMatutino, $horaFinVespertino);*/ echo casoEspecialMatutino($horaMinuto, $horaFinMatutino); } checktime("2017-06-15 16:29:00",30); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gHqp0
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   INIT_FCALL                                               'checktime'
          1        SEND_VAL                                                 '2017-06-15+16%3A29%3A00'
          2        SEND_VAL                                                 30
          3        DO_FCALL                                      0          
   50     4      > RETURN                                                   1

Function tipohorario:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 14, Position 2 = 19
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 32
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 35
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 46) Position 1 = 40, Position 2 = 45
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 48
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
Branch analysis from position: 32
Branch analysis from position: 19
filename:       /in/gHqp0
function name:  tipoHorario
number of ops:  50
compiled vars:  !0 = $hora, !1 = $inicioMatutino, !2 = $inicioVespertino, !3 = $finMatutino, !4 = $finVespertino, !5 = $horaUTC
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
    4     5        INIT_FCALL                                               'strtotime'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !5, $6
    5     9        INIT_FCALL                                               'strtotime'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $8      
         12        IS_SMALLER_OR_EQUAL                              ~9      $8, !5
         13      > JMPZ_EX                                          ~9      ~9, ->19
         14    >   INIT_FCALL                                               'strtotime'
         15        SEND_VAR                                                 !3
         16        DO_ICALL                                         $10     
         17        IS_SMALLER                                       ~11     !5, $10
         18        BOOL                                             ~9      ~11
         19    > > JMPZ                                                     ~9, ->22
    6    20    > > RETURN                                                   'Matutino'
         21*       JMP                                                      ->49
    8    22    >   INIT_FCALL                                               'strtotime'
         23        SEND_VAR                                                 !3
         24        DO_ICALL                                         $12     
         25        IS_SMALLER_OR_EQUAL                              ~13     $12, !5
         26      > JMPZ_EX                                          ~13     ~13, ->32
         27    >   INIT_FCALL                                               'strtotime'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $14     
         30        IS_SMALLER                                       ~15     !5, $14
         31        BOOL                                             ~13     ~15
         32    > > JMPZ                                                     ~13, ->35
    9    33    > > RETURN                                                   'Descanso+matutino'
         34*       JMP                                                      ->49
   11    35    >   INIT_FCALL                                               'strtotime'
         36        SEND_VAR                                                 !2
         37        DO_ICALL                                         $16     
         38        IS_SMALLER_OR_EQUAL                              ~17     $16, !5
         39      > JMPZ_EX                                          ~17     ~17, ->45
         40    >   INIT_FCALL                                               'strtotime'
         41        SEND_VAR                                                 !4
         42        DO_ICALL                                         $18     
         43        IS_SMALLER                                       ~19     !5, $18
         44        BOOL                                             ~17     ~19
         45    > > JMPZ                                                     ~17, ->48
   12    46    > > RETURN                                                   'Vespertino'
         47*       JMP                                                      ->49
   14    48    > > RETURN                                                   'Descanso+vespertino'
   15    49*     > RETURN                                                   null

End of function tipohorario

Function casoespecialmatutino:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gHqp0
function name:  casoEspecialMatutino
number of ops:  13
compiled vars:  !0 = $hora, !1 = $finMatutino, !2 = $previoFinMatutino
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        INIT_FCALL                                               'date'
          3        SEND_VAL                                                 'H%3Ai'
          4        INIT_FCALL                                               'strtotime'
          5        CONCAT                                           ~3      !2, '+-30+minutes'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8        SEND_VAR                                                 $4
          9        DO_ICALL                                         $5      
         10        ASSIGN                                                   !2, $5
   19    11        ECHO                                                     !2
   20    12      > RETURN                                                   null

End of function casoespecialmatutino

Function casoespecialvespertino:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gHqp0
function name:  casoEspecialVespertino
number of ops:  3
compiled vars:  !0 = $hora, !1 = $finVespertino
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2      > RETURN                                                   null

End of function casoespecialvespertino

Function checktime:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gHqp0
function name:  checktime
number of ops:  36
compiled vars:  !0 = $fechaHora, !1 = $minutosTolerancia, !2 = $fecha, !3 = $horaMinuto, !4 = $noDia, !5 = $horaInicioMatutino, !6 = $horaFinMatutino, !7 = $horaInicioVespertino, !8 = $horaFinVespertino
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   28     2        INIT_FCALL                                               'date'
          3        SEND_VAL                                                 'Y-m-d'
          4        INIT_FCALL                                               'strtotime'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $9      
          7        SEND_VAR                                                 $9
          8        DO_ICALL                                         $10     
          9        ASSIGN                                                   !2, $10
   29    10        INIT_FCALL                                               'date'
         11        SEND_VAL                                                 'H%3Ai'
         12        INIT_FCALL                                               'strtotime'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $12     
         15        SEND_VAR                                                 $12
         16        DO_ICALL                                         $13     
         17        ASSIGN                                                   !3, $13
   30    18        INIT_FCALL                                               'date'
         19        SEND_VAL                                                 'N'
         20        INIT_FCALL                                               'strtotime'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                         $15     
         23        SEND_VAR                                                 $15
         24        DO_ICALL                                         $16     
         25        ASSIGN                                                   !4, $16
   32    26        ASSIGN                                                   !5, '09%3A00'
   33    27        ASSIGN                                                   !6, '15%3A00'
   34    28        ASSIGN                                                   !7, '16%3A30'
   35    29        ASSIGN                                                   !8, '18%3A30'
   42    30        INIT_FCALL                                               'casoespecialmatutino'
         31        SEND_VAR                                                 !3
         32        SEND_VAR                                                 !6
         33        DO_FCALL                                      0  $22     
         34        ECHO                                                     $22
   43    35      > RETURN                                                   null

End of function checktime

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.04 ms | 1407 KiB | 19 Q