3v4l.org

run code in 300+ PHP versions simultaneously
<?php function checkOGRN($ogrn){ if (strlen($ogrn) == 13) { $verify_num = intval(substr($ogrn, 0, 12)); $check_num = intval(substr($ogrn, -1)); $res_num = $verify_num % 11; } elseif (strlen($ogrn) == 15) { $verify_num = intval(substr($ogrn, 0, 14)); $check_num = intval(substr($ogrn, -1)); $res_num = $verify_num % 13; } else return false; if ($res_num > 9) $res_num = $res_num - round($res_num/10)*10; return ($res_num == $check); } if(checkOGRN('311333426300044')) echo 'OK'; else echo 'Error';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nrd44
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'checkogrn'
          1        SEND_VAL                                                 '311333426300044'
          2        DO_FCALL                                      0  $0      
          3      > JMPZ                                                     $0, ->6
   17     4    >   ECHO                                                     'OK'
          5      > JMP                                                      ->7
   19     6    >   ECHO                                                     'Error'
          7    > > RETURN                                                   1

Function checkogrn:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 49
Branch analysis from position: 42
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 49
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 39
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nrd44
function name:  checkOGRN
number of ops:  52
compiled vars:  !0 = $ogrn, !1 = $verify_num, !2 = $check_num, !3 = $res_num, !4 = $check
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        STRLEN                                           ~5      !0
          2        IS_EQUAL                                                 ~5, 13
          3      > JMPZ                                                     ~6, ->20
    4     4    >   INIT_FCALL                                               'substr'
          5        SEND_VAR                                                 !0
          6        SEND_VAL                                                 0
          7        SEND_VAL                                                 12
          8        DO_ICALL                                         $7      
          9        CAST                                          4  ~8      $7
         10        ASSIGN                                                   !1, ~8
    5    11        INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 -1
         14        DO_ICALL                                         $10     
         15        CAST                                          4  ~11     $10
         16        ASSIGN                                                   !2, ~11
    6    17        MOD                                              ~13     !1, 11
         18        ASSIGN                                                   !3, ~13
         19      > JMP                                                      ->40
    7    20    >   STRLEN                                           ~15     !0
         21        IS_EQUAL                                                 ~15, 15
         22      > JMPZ                                                     ~16, ->39
    8    23    >   INIT_FCALL                                               'substr'
         24        SEND_VAR                                                 !0
         25        SEND_VAL                                                 0
         26        SEND_VAL                                                 14
         27        DO_ICALL                                         $17     
         28        CAST                                          4  ~18     $17
         29        ASSIGN                                                   !1, ~18
    9    30        INIT_FCALL                                               'substr'
         31        SEND_VAR                                                 !0
         32        SEND_VAL                                                 -1
         33        DO_ICALL                                         $20     
         34        CAST                                          4  ~21     $20
         35        ASSIGN                                                   !2, ~21
   10    36        MOD                                              ~23     !1, 13
         37        ASSIGN                                                   !3, ~23
         38      > JMP                                                      ->40
   11    39    > > RETURN                                                   <false>
   12    40    >   IS_SMALLER                                               9, !3
         41      > JMPZ                                                     ~25, ->49
   13    42    >   INIT_FCALL                                               'round'
         43        DIV                                              ~26     !3, 10
         44        SEND_VAL                                                 ~26
         45        DO_ICALL                                         $27     
         46        MUL                                              ~28     $27, 10
         47        SUB                                              ~29     !3, ~28
         48        ASSIGN                                                   !3, ~29
   14    49    >   IS_EQUAL                                         ~31     !3, !4
         50      > RETURN                                                   ~31
   15    51*     > RETURN                                                   null

End of function checkogrn

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.14 ms | 1394 KiB | 18 Q