3v4l.org

run code in 300+ PHP versions simultaneously
<?php function checkPositiveInt($var) { if (is_numeric($var)) { if (is_int($var)) { if ($var > 0) { return true; } } } return false; } $devidL = '05.08.2017'; $arrayInputsState['devid'] = ''; if ($devidL != '') { $arrayDate = explode(".", $devidL); $numberOfValid = 0; if (checkPositiveInt($arrayDate[0])) { $day = (int)$arrayDate[0]; ++$numberOfValid; } if (checkPositiveInt($arrayDate[1])) { $month = (int)$arrayDate[1]; ++$numberOfValid; } if (checkPositiveInt($arrayDate[2])) { $year = (int)$arrayDate[2]; ++$numberOfValid; } if ($numberOfValid == 3) { echo 'ok'; if (checkdate($month, $day, $year)) { $date = \DateTime::createFromFormat('d.m.Y', $devidL); if ($date) { $Zaznam->setDEVID($date); $arrayInputsState['devid'] = 'ok'; } else { $arrayInputsState['devid'] = 'error'; } } else { $arrayInputsState['devid'] = 'error'; } } } else { $arrayInputsState['devid'] = 'empty'; } echo 'vysledok je <br>'; var_dump($arrayInputsState['devid']);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 65
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 29
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 38
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 64
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 47, Position 2 = 62
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 53, Position 2 = 59
Branch analysis from position: 53
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
Branch analysis from position: 62
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
Branch analysis from position: 64
Branch analysis from position: 38
Branch analysis from position: 29
Branch analysis from position: 20
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iIB59
function name:  (null)
number of ops:  73
compiled vars:  !0 = $devidL, !1 = $arrayInputsState, !2 = $arrayDate, !3 = $numberOfValid, !4 = $day, !5 = $month, !6 = $year, !7 = $date, !8 = $Zaznam
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, '05.08.2017'
   14     1        ASSIGN_DIM                                               !1, 'devid'
          2        OP_DATA                                                  ''
   15     3        IS_NOT_EQUAL                                             !0, ''
          4      > JMPZ                                                     ~11, ->65
   16     5    >   INIT_FCALL                                               'explode'
          6        SEND_VAL                                                 '.'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $12     
          9        ASSIGN                                                   !2, $12
   17    10        ASSIGN                                                   !3, 0
   18    11        INIT_FCALL                                               'checkpositiveint'
         12        FETCH_DIM_R                                      ~15     !2, 0
         13        SEND_VAL                                                 ~15
         14        DO_FCALL                                      0  $16     
         15      > JMPZ                                                     $16, ->20
   19    16    >   FETCH_DIM_R                                      ~17     !2, 0
         17        CAST                                          4  ~18     ~17
         18        ASSIGN                                                   !4, ~18
   20    19        PRE_INC                                                  !3
   22    20    >   INIT_FCALL                                               'checkpositiveint'
         21        FETCH_DIM_R                                      ~21     !2, 1
         22        SEND_VAL                                                 ~21
         23        DO_FCALL                                      0  $22     
         24      > JMPZ                                                     $22, ->29
   23    25    >   FETCH_DIM_R                                      ~23     !2, 1
         26        CAST                                          4  ~24     ~23
         27        ASSIGN                                                   !5, ~24
   24    28        PRE_INC                                                  !3
   26    29    >   INIT_FCALL                                               'checkpositiveint'
         30        FETCH_DIM_R                                      ~27     !2, 2
         31        SEND_VAL                                                 ~27
         32        DO_FCALL                                      0  $28     
         33      > JMPZ                                                     $28, ->38
   27    34    >   FETCH_DIM_R                                      ~29     !2, 2
         35        CAST                                          4  ~30     ~29
         36        ASSIGN                                                   !6, ~30
   28    37        PRE_INC                                                  !3
   30    38    >   IS_EQUAL                                                 !3, 3
         39      > JMPZ                                                     ~33, ->64
   31    40    >   ECHO                                                     'ok'
   32    41        INIT_FCALL                                               'checkdate'
         42        SEND_VAR                                                 !5
         43        SEND_VAR                                                 !4
         44        SEND_VAR                                                 !6
         45        DO_ICALL                                         $34     
         46      > JMPZ                                                     $34, ->62
   33    47    >   INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         48        SEND_VAL                                                 'd.m.Y'
         49        SEND_VAR                                                 !0
         50        DO_FCALL                                      0  $35     
         51        ASSIGN                                                   !7, $35
   34    52      > JMPZ                                                     !7, ->59
   35    53    >   INIT_METHOD_CALL                                         !8, 'setDEVID'
         54        SEND_VAR_EX                                              !7
         55        DO_FCALL                                      0          
   36    56        ASSIGN_DIM                                               !1, 'devid'
         57        OP_DATA                                                  'ok'
         58      > JMP                                                      ->61
   38    59    >   ASSIGN_DIM                                               !1, 'devid'
         60        OP_DATA                                                  'error'
         61    > > JMP                                                      ->64
   41    62    >   ASSIGN_DIM                                               !1, 'devid'
         63        OP_DATA                                                  'error'
         64    > > JMP                                                      ->67
   45    65    >   ASSIGN_DIM                                               !1, 'devid'
         66        OP_DATA                                                  'empty'
   47    67    >   ECHO                                                     'vysledok+je+%3Cbr%3E'
   48    68        INIT_FCALL                                               'var_dump'
         69        FETCH_DIM_R                                      ~42     !1, 'devid'
         70        SEND_VAL                                                 ~42
         71        DO_ICALL                                                 
         72      > RETURN                                                   1

Function checkpositiveint:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 10
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 10
filename:       /in/iIB59
function name:  checkPositiveInt
number of ops:  12
compiled vars:  !0 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'is_numeric'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > JMPZ                                                     $1, ->10
    4     5    >   TYPE_CHECK                                   16          !0
          6      > JMPZ                                                     ~2, ->10
    5     7    >   IS_SMALLER                                               0, !0
          8      > JMPZ                                                     ~3, ->10
    6     9    > > RETURN                                                   <true>
   10    10    > > RETURN                                                   <false>
   11    11*     > RETURN                                                   null

End of function checkpositiveint

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.06 ms | 1407 KiB | 24 Q