3v4l.org

run code in 300+ PHP versions simultaneously
<?php $prefix = (string) 1234; $id = (string) 3; $number = $prefix . str_repeat('0', 12 - strlen($prefix) - strlen($id)) . $id; $odd = true; $checksum = 0; $key = range(0, 9); for ($i = strlen($number); $i > 0; $i--) { $checksum += $key[$number[$i - 1]] * ($odd = !$odd ? 3 : 1); } $checksum = 10 - $checksum % 10; $checksum = ($checksum == 10) ? 0 : $checksum; echo $number . $checksum;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 25
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 46
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 25
Branch analysis from position: 39
Branch analysis from position: 25
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 25
Branch analysis from position: 39
Branch analysis from position: 25
filename:       /in/v3HXP
function name:  (null)
number of ops:  51
compiled vars:  !0 = $prefix, !1 = $id, !2 = $number, !3 = $odd, !4 = $checksum, !5 = $key, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   CAST                                          6  ~7      1234
          1        ASSIGN                                                   !0, ~7
    3     2        CAST                                          6  ~9      3
          3        ASSIGN                                                   !1, ~9
    5     4        INIT_FCALL                                               'str_repeat'
          5        SEND_VAL                                                 '0'
          6        STRLEN                                           ~11     !0
          7        SUB                                              ~12     12, ~11
          8        STRLEN                                           ~13     !1
          9        SUB                                              ~14     ~12, ~13
         10        SEND_VAL                                                 ~14
         11        DO_ICALL                                         $15     
         12        CONCAT                                           ~16     !0, $15
         13        CONCAT                                           ~17     ~16, !1
         14        ASSIGN                                                   !2, ~17
    7    15        ASSIGN                                                   !3, <true>
    8    16        ASSIGN                                                   !4, 0
    9    17        INIT_FCALL                                               'range'
         18        SEND_VAL                                                 0
         19        SEND_VAL                                                 9
         20        DO_ICALL                                         $21     
         21        ASSIGN                                                   !5, $21
   10    22        STRLEN                                           ~23     !2
         23        ASSIGN                                                   !6, ~23
         24      > JMP                                                      ->37
   11    25    >   SUB                                              ~25     !6, 1
         26        FETCH_DIM_R                                      ~26     !2, ~25
         27        FETCH_DIM_R                                      ~27     !5, ~26
         28        BOOL_NOT                                         ~28     !3
         29      > JMPZ                                                     ~28, ->32
         30    >   QM_ASSIGN                                        ~29     3
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~29     1
         33    >   ASSIGN                                           ~30     !3, ~29
         34        MUL                                              ~31     ~27, ~30
         35        ASSIGN_OP                                     1          !4, ~31
   10    36        PRE_DEC                                                  !6
         37    >   IS_SMALLER                                               0, !6
         38      > JMPNZ                                                    ~34, ->25
   13    39    >   MOD                                              ~35     !4, 10
         40        SUB                                              ~36     10, ~35
         41        ASSIGN                                                   !4, ~36
   14    42        IS_EQUAL                                                 !4, 10
         43      > JMPZ                                                     ~38, ->46
         44    >   QM_ASSIGN                                        ~39     0
         45      > JMP                                                      ->47
         46    >   QM_ASSIGN                                        ~39     !4
         47    >   ASSIGN                                                   !4, ~39
   15    48        CONCAT                                           ~41     !2, !4
         49        ECHO                                                     ~41
         50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
194.64 ms | 1400 KiB | 17 Q