3v4l.org

run code in 300+ PHP versions simultaneously
<?php function base26($value) { $name = ''; for ($exponent = 0; pow(26, $exponent) <= $value; $exponent++) { $digitValue = intval(pow(26, $exponent)); $remainder = $value % intval(pow(26, $exponent + 1)); $ascii = 64 + intval($remainder / $digitValue); $name = chr($ascii) . $name; echo sprintf("digitValue: %d, ascii: %d, value: %d, remainder: %d\n", $digitValue, $ascii, $value, $remainder); $value -= $remainder; } return $name; } for ($i = 1; $i < 28; $i++) { echo $i . "->" . base26($i) . "\n"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 2
Branch analysis from position: 12
Branch analysis from position: 2
filename:       /in/7T9UL
function name:  (null)
number of ops:  13
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, 1
          1      > JMP                                                      ->10
          2    >   CONCAT                                           ~2      !0, '-%3E'
          3        INIT_FCALL                                               'base26'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $3      
          6        CONCAT                                           ~4      ~2, $3
          7        CONCAT                                           ~5      ~4, '%0A'
          8        ECHO                                                     ~5
          9        PRE_INC                                                  !0
         10    >   IS_SMALLER                                               !0, 28
         11      > JMPNZ                                                    ~7, ->2
         12    > > RETURN                                                   1

Function base26:
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 = 43, Position 2 = 4
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 4
Branch analysis from position: 43
Branch analysis from position: 4
filename:       /in/7T9UL
function name:  base26
number of ops:  45
compiled vars:  !0 = $value, !1 = $name, !2 = $exponent, !3 = $digitValue, !4 = $remainder, !5 = $ascii
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, ''
    4     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->37
    5     4    >   INIT_FCALL                                               'pow'
          5        SEND_VAL                                                 26
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $8      
          8        CAST                                          4  ~9      $8
          9        ASSIGN                                                   !3, ~9
    6    10        INIT_FCALL                                               'pow'
         11        SEND_VAL                                                 26
         12        ADD                                              ~11     !2, 1
         13        SEND_VAL                                                 ~11
         14        DO_ICALL                                         $12     
         15        CAST                                          4  ~13     $12
         16        MOD                                              ~14     !0, ~13
         17        ASSIGN                                                   !4, ~14
    7    18        DIV                                              ~16     !4, !3
         19        CAST                                          4  ~17     ~16
         20        ADD                                              ~18     64, ~17
         21        ASSIGN                                                   !5, ~18
    8    22        INIT_FCALL                                               'chr'
         23        SEND_VAR                                                 !5
         24        DO_ICALL                                         $20     
         25        CONCAT                                           ~21     $20, !1
         26        ASSIGN                                                   !1, ~21
    9    27        INIT_FCALL                                               'sprintf'
         28        SEND_VAL                                                 'digitValue%3A+%25d%2C+ascii%3A+%25d%2C+value%3A+%25d%2C+remainder%3A+%25d%0A'
         29        SEND_VAR                                                 !3
         30        SEND_VAR                                                 !5
         31        SEND_VAR                                                 !0
         32        SEND_VAR                                                 !4
         33        DO_ICALL                                         $23     
         34        ECHO                                                     $23
   10    35        ASSIGN_OP                                     2          !0, !4
    4    36        PRE_INC                                                  !2
         37    >   INIT_FCALL                                               'pow'
         38        SEND_VAL                                                 26
         39        SEND_VAR                                                 !2
         40        DO_ICALL                                         $26     
         41        IS_SMALLER_OR_EQUAL                                      $26, !0
         42      > JMPNZ                                                    ~27, ->4
   12    43    > > RETURN                                                   !1
   13    44*     > RETURN                                                   null

End of function base26

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.58 ms | 1403 KiB | 20 Q