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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.82 ms | 1400 KiB | 17 Q