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 ? 3 : 1); $odd = !$odd; } $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 = 29, Position 2 = 31
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 32
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
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 25
Branch analysis from position: 39
Branch analysis from position: 25
filename:       /in/ASZaG
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      > JMPZ                                                     !3, ->31
         29    >   QM_ASSIGN                                        ~28     3
         30      > JMP                                                      ->32
         31    >   QM_ASSIGN                                        ~28     1
         32    >   MUL                                              ~29     ~27, ~28
         33        ASSIGN_OP                                     1          !4, ~29
   12    34        BOOL_NOT                                         ~31     !3
         35        ASSIGN                                                   !3, ~31
   10    36        PRE_DEC                                                  !6
         37    >   IS_SMALLER                                               0, !6
         38      > JMPNZ                                                    ~34, ->25
   14    39    >   MOD                                              ~35     !4, 10
         40        SUB                                              ~36     10, ~35
         41        ASSIGN                                                   !4, ~36
   15    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
   16    48        CONCAT                                           ~41     !2, !4
         49        ECHO                                                     ~41
         50      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.67 ms | 1400 KiB | 17 Q