3v4l.org

run code in 300+ PHP versions simultaneously
<?php function _generateChecksum($eanCodeWithoutChecksum) { $key = 0; $mult = array(1, 3); for ($i = 0; $i < strlen($eanCodeWithoutChecksum); $i++) $key += substr($eanCodeWithoutChecksum, $i, 1) * $mult[$i % 2]; $key = 10 - ( $key % 10 ); if ($key == 10) $key = 0; return $key; } echo _generateChecksum(209100000001);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Vuadu
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               '_generatechecksum'
          1        SEND_VAL                                                 209100000001
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function _generatechecksum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 5
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 5
Branch analysis from position: 18
Branch analysis from position: 5
filename:       /in/Vuadu
function name:  _generateChecksum
number of ops:  26
compiled vars:  !0 = $eanCodeWithoutChecksum, !1 = $key, !2 = $mult, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, 0
    5     2        ASSIGN                                                   !2, <array>
    7     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->15
    8     5    >   INIT_FCALL                                               'substr'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !3
          8        SEND_VAL                                                 1
          9        DO_ICALL                                         $7      
         10        MOD                                              ~8      !3, 2
         11        FETCH_DIM_R                                      ~9      !2, ~8
         12        MUL                                              ~10     $7, ~9
         13        ASSIGN_OP                                     1          !1, ~10
    7    14        PRE_INC                                                  !3
         15    >   STRLEN                                           ~13     !0
         16        IS_SMALLER                                               !3, ~13
         17      > JMPNZ                                                    ~14, ->5
   10    18    >   MOD                                              ~15     !1, 10
         19        SUB                                              ~16     10, ~15
         20        ASSIGN                                                   !1, ~16
   12    21        IS_EQUAL                                                 !1, 10
         22      > JMPZ                                                     ~18, ->24
   13    23    >   ASSIGN                                                   !1, 0
   15    24    > > RETURN                                                   !1
   16    25*     > RETURN                                                   null

End of function _generatechecksum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.3 ms | 1390 KiB | 16 Q