3v4l.org

run code in 300+ PHP versions simultaneously
<?php $asin = "B00ICQMBZG"; if (strlen($asin) == 13) { $odd = 0; $even = 0; $asinChar = str_split("978" . $asin); for ($i = 0; $i < 12; $i++) { if (($i % 2) !== 1) { $odd = $odd + $asinChar[$i]; } else { $even = $even + $asinChar[$i]; } } $sum = $odd + ($even * 3); $i = -1; do { $i++; $checksum = ceil($sum + $i) - $sum; } while (ceil($sum + $i) % 10 != 0); } else { $asinChar = str_split($asin); $num = 0; /** Zehnstellige ISBN Nummern bzw. Asins */ for ($i = 0; $i < 9; $i++) { $num = $num + ($asinChar[$i] * ($i + 1)); } $checksum = fmod($num, 11); } echo "978" . substr($asin, 0, 9) . $checksum;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 45
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 13
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 30
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 65
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 13
Branch analysis from position: 26
Branch analysis from position: 13
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 13
Branch analysis from position: 26
Branch analysis from position: 13
Branch analysis from position: 45
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 52
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 52
Branch analysis from position: 60
Branch analysis from position: 52
filename:       /in/7OYaB
function name:  (null)
number of ops:  74
compiled vars:  !0 = $asin, !1 = $odd, !2 = $even, !3 = $asinChar, !4 = $i, !5 = $sum, !6 = $checksum, !7 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'B00ICQMBZG'
    4     1        STRLEN                                           ~9      !0
          2        IS_EQUAL                                                 ~9, 13
          3      > JMPZ                                                     ~10, ->45
    6     4    >   ASSIGN                                                   !1, 0
    7     5        ASSIGN                                                   !2, 0
    8     6        INIT_FCALL                                               'str_split'
          7        CONCAT                                           ~13     '978', !0
          8        SEND_VAL                                                 ~13
          9        DO_ICALL                                         $14     
         10        ASSIGN                                                   !3, $14
    9    11        ASSIGN                                                   !4, 0
         12      > JMP                                                      ->24
   11    13    >   MOD                                              ~17     !4, 2
         14        IS_NOT_IDENTICAL                                         ~17, 1
         15      > JMPZ                                                     ~18, ->20
   12    16    >   FETCH_DIM_R                                      ~19     !3, !4
         17        ADD                                              ~20     !1, ~19
         18        ASSIGN                                                   !1, ~20
         19      > JMP                                                      ->23
   14    20    >   FETCH_DIM_R                                      ~22     !3, !4
         21        ADD                                              ~23     !2, ~22
         22        ASSIGN                                                   !2, ~23
    9    23    >   PRE_INC                                                  !4
         24    >   IS_SMALLER                                               !4, 12
         25      > JMPNZ                                                    ~26, ->13
   18    26    >   MUL                                              ~27     !2, 3
         27        ADD                                              ~28     !1, ~27
         28        ASSIGN                                                   !5, ~28
   20    29        ASSIGN                                                   !4, -1
   22    30    >   PRE_INC                                                  !4
   23    31        INIT_FCALL                                               'ceil'
         32        ADD                                              ~32     !5, !4
         33        SEND_VAL                                                 ~32
         34        DO_ICALL                                         $33     
         35        SUB                                              ~34     $33, !5
         36        ASSIGN                                                   !6, ~34
   24    37        INIT_FCALL                                               'ceil'
         38        ADD                                              ~36     !5, !4
         39        SEND_VAL                                                 ~36
         40        DO_ICALL                                         $37     
         41        MOD                                              ~38     $37, 10
         42        IS_NOT_EQUAL                                             ~38, 0
         43      > JMPNZ                                                    ~39, ->30
         44    > > JMP                                                      ->65
   26    45    >   INIT_FCALL                                               'str_split'
         46        SEND_VAR                                                 !0
         47        DO_ICALL                                         $40     
         48        ASSIGN                                                   !3, $40
   27    49        ASSIGN                                                   !7, 0
   29    50        ASSIGN                                                   !4, 0
         51      > JMP                                                      ->58
   30    52    >   FETCH_DIM_R                                      ~44     !3, !4
         53        ADD                                              ~45     !4, 1
         54        MUL                                              ~46     ~44, ~45
         55        ADD                                              ~47     !7, ~46
         56        ASSIGN                                                   !7, ~47
   29    57        PRE_INC                                                  !4
         58    >   IS_SMALLER                                               !4, 9
         59      > JMPNZ                                                    ~50, ->52
   32    60    >   INIT_FCALL                                               'fmod'
         61        SEND_VAR                                                 !7
         62        SEND_VAL                                                 11
         63        DO_ICALL                                         $51     
         64        ASSIGN                                                   !6, $51
   35    65    >   INIT_FCALL                                               'substr'
         66        SEND_VAR                                                 !0
         67        SEND_VAL                                                 0
         68        SEND_VAL                                                 9
         69        DO_ICALL                                         $53     
         70        CONCAT                                           ~54     '978', $53
         71        CONCAT                                           ~55     ~54, !6
         72        ECHO                                                     ~55
         73      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.47 ms | 1405 KiB | 21 Q