3v4l.org

run code in 300+ PHP versions simultaneously
<?php function decode_char2($c) { $a1 = array("0", "1", "2", "3", "4", "5", "6", "7", "9", "H", "M", "D", "X", "V", "J", "Q", "U", "G", "E", "T", "N", "o", "v", "y", "w", "k"); $a2 = array("c", "I", "W", "m", "8", "L", "l", "g", "R", "B", "a", "u", "s", "p", "z", "Z", "e", "d", "=", "x", "Y", "t", "n", "f", "b", "i"); $result = $c; for($j = 0; $j < count($a1); $j++) { if ($c == $a1[$j][0]) { $result = $a2[$j][0]; break; } if ($c == $a2[$j][0]) { $result = $a1[$j][0]; break; } } return $result; } function reverse($s, $direct) { if ($direct == 'd') { $nlen = strlen($s)-3; $r = ''; while ($nlen > 2) { $r .= substr($s,$nlen,1); $nlen--; } $nlen = strlen($r); $nlen2 = intval(substr($s,1,1).substr($s,0,1)); $nlen2 = $nlen2 / 2; if ($nlen2 < $nlen) { $npos = $nlen2; while ($npos < $nlen) { $r = substr($r,0, $npos) . substr($r,$npos + 1); $npos += $nlen2; } } } else { $nlen = strlen($s); $delta = 7; if (($nlen % $delta) == 0) $delta = 8; $s0 = $s; $s7 = substr($s0,0,$delta); $s0 = substr($s0,$delta); $s = ''; while ((strlen($s7) == $delta) && (strlen($s0) > 0)) { $s .= $s7 . 'd'; $s7 = substr($s0,0,$delta); $s0 = substr($s0,$delta); } $s .= $s7; $nlen = strlen($s)-1; $r = ''; while ($nlen >= 0) { $r .= substr($s,$nlen,1); $nlen--; } $delta2 = $delta + $delta; $sdelta2 = "$delta2"; $sdelta4 = substr($sdelta2,1,1) . substr($sdelta2,0,1); $r = $sdelta4 . 'A' . $r . 'rs'; } return($r); } function decode_str2($s) { $s = reverse($s,"d"); $result = ''; for($i = 0; $i < strlen($s); $i++) { $result .= decode_char2($s[$i]); } $result = base64_decode($result); return $result; } function encode_str2($s) { $s = base64_encode($s); $result = ''; for($i = 0; $i < strlen($s); $i++) { $result .= decode_char2($s[$i]); } $result = reverse($result,"e"); return $result; } echo decode_str2("2iob3gRLvctM31EMtgTM25k40Cm=2xmLkasB05wbv1GjttQ3N1AbOxFjkjy5OdE1UjANtjwhkgTakQtWydnbtgGjvc9h0SJ52xWM3NJR3QnL3dJ1GI4h3ayRkxmB6fZMtjAWyCm50iUr");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BjLdm
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   93     0  E >   INIT_FCALL                                               'decode_str2'
          1        SEND_VAL                                                 '2iob3gRLvctM31EMtgTM25k40Cm%3D2xmLkasB05wbv1GjttQ3N1AbOxFjkjy5OdE1UjANtjwhkgTakQtWydnbtgGjvc9h0SJ52xWM3NJR3QnL3dJ1GI4h3ayRkxmB6fZMtjAWyCm50iUr'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function decode_char2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 6
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 14
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 6
Branch analysis from position: 26
Branch analysis from position: 6
filename:       /in/BjLdm
function name:  decode_char2
number of ops:  28
compiled vars:  !0 = $c, !1 = $a1, !2 = $a2, !3 = $result, !4 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        ASSIGN                                                   !2, <array>
    6     3        ASSIGN                                                   !3, !0
    7     4        ASSIGN                                                   !4, 0
          5      > JMP                                                      ->23
    8     6    >   FETCH_DIM_R                                      ~9      !1, !4
          7        FETCH_DIM_R                                      ~10     ~9, 0
          8        IS_EQUAL                                                 !0, ~10
          9      > JMPZ                                                     ~11, ->14
    9    10    >   FETCH_DIM_R                                      ~12     !2, !4
         11        FETCH_DIM_R                                      ~13     ~12, 0
         12        ASSIGN                                                   !3, ~13
   10    13      > JMP                                                      ->26
   12    14    >   FETCH_DIM_R                                      ~15     !2, !4
         15        FETCH_DIM_R                                      ~16     ~15, 0
         16        IS_EQUAL                                                 !0, ~16
         17      > JMPZ                                                     ~17, ->22
   13    18    >   FETCH_DIM_R                                      ~18     !1, !4
         19        FETCH_DIM_R                                      ~19     ~18, 0
         20        ASSIGN                                                   !3, ~19
   14    21      > JMP                                                      ->26
    7    22    >   PRE_INC                                                  !4
         23    >   COUNT                                            ~22     !1
         24        IS_SMALLER                                               !4, ~22
         25      > JMPNZ                                                    ~23, ->6
   17    26    > > RETURN                                                   !3
   18    27*     > RETURN                                                   null

End of function decode_char2

Function reverse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 55
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 54
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 39
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 131
Branch analysis from position: 131
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 39
Branch analysis from position: 54
Branch analysis from position: 39
Branch analysis from position: 54
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
Branch analysis from position: 9
Branch analysis from position: 55
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 62
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 89
Branch analysis from position: 89
2 jumps found. (Code = 46) Position 1 = 92, Position 2 = 95
Branch analysis from position: 92
2 jumps found. (Code = 44) Position 1 = 96, Position 2 = 76
Branch analysis from position: 96
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
2 jumps found. (Code = 44) Position 1 = 111, Position 2 = 102
Branch analysis from position: 111
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 102
2 jumps found. (Code = 44) Position 1 = 111, Position 2 = 102
Branch analysis from position: 111
Branch analysis from position: 102
Branch analysis from position: 76
2 jumps found. (Code = 46) Position 1 = 92, Position 2 = 95
Branch analysis from position: 92
Branch analysis from position: 95
Branch analysis from position: 95
Branch analysis from position: 62
filename:       /in/BjLdm
function name:  reverse
number of ops:  133
compiled vars:  !0 = $s, !1 = $direct, !2 = $nlen, !3 = $r, !4 = $nlen2, !5 = $npos, !6 = $delta, !7 = $s0, !8 = $s7, !9 = $delta2, !10 = $sdelta2, !11 = $sdelta4
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2        IS_EQUAL                                                 !1, 'd'
          3      > JMPZ                                                     ~12, ->55
   23     4    >   STRLEN                                           ~13     !0
          5        SUB                                              ~14     ~13, 3
          6        ASSIGN                                                   !2, ~14
   24     7        ASSIGN                                                   !3, ''
   25     8      > JMP                                                      ->16
   26     9    >   INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !2
         12        SEND_VAL                                                 1
         13        DO_ICALL                                         $17     
         14        ASSIGN_OP                                     8          !3, $17
   27    15        PRE_DEC                                                  !2
   25    16    >   IS_SMALLER                                               2, !2
         17      > JMPNZ                                                    ~20, ->9
   29    18    >   STRLEN                                           ~21     !3
         19        ASSIGN                                                   !2, ~21
   30    20        INIT_FCALL                                               'substr'
         21        SEND_VAR                                                 !0
         22        SEND_VAL                                                 1
         23        SEND_VAL                                                 1
         24        DO_ICALL                                         $23     
         25        INIT_FCALL                                               'substr'
         26        SEND_VAR                                                 !0
         27        SEND_VAL                                                 0
         28        SEND_VAL                                                 1
         29        DO_ICALL                                         $24     
         30        CONCAT                                           ~25     $23, $24
         31        CAST                                          4  ~26     ~25
         32        ASSIGN                                                   !4, ~26
   31    33        DIV                                              ~28     !4, 2
         34        ASSIGN                                                   !4, ~28
   33    35        IS_SMALLER                                               !4, !2
         36      > JMPZ                                                     ~30, ->54
   35    37    >   ASSIGN                                                   !5, !4
   36    38      > JMP                                                      ->52
   38    39    >   INIT_FCALL                                               'substr'
         40        SEND_VAR                                                 !3
         41        SEND_VAL                                                 0
         42        SEND_VAR                                                 !5
         43        DO_ICALL                                         $32     
         44        INIT_FCALL                                               'substr'
         45        SEND_VAR                                                 !3
         46        ADD                                              ~33     !5, 1
         47        SEND_VAL                                                 ~33
         48        DO_ICALL                                         $34     
         49        CONCAT                                           ~35     $32, $34
         50        ASSIGN                                                   !3, ~35
   39    51        ASSIGN_OP                                     1          !5, !4
   36    52    >   IS_SMALLER                                               !5, !2
         53      > JMPNZ                                                    ~38, ->39
         54    > > JMP                                                      ->131
   43    55    >   STRLEN                                           ~39     !0
         56        ASSIGN                                                   !2, ~39
   44    57        ASSIGN                                                   !6, 7
   45    58        MOD                                              ~42     !2, !6
         59        IS_EQUAL                                                 ~42, 0
         60      > JMPZ                                                     ~43, ->62
         61    >   ASSIGN                                                   !6, 8
   46    62    >   ASSIGN                                                   !7, !0
   47    63        INIT_FCALL                                               'substr'
         64        SEND_VAR                                                 !7
         65        SEND_VAL                                                 0
         66        SEND_VAR                                                 !6
         67        DO_ICALL                                         $46     
         68        ASSIGN                                                   !8, $46
   48    69        INIT_FCALL                                               'substr'
         70        SEND_VAR                                                 !7
         71        SEND_VAR                                                 !6
         72        DO_ICALL                                         $48     
         73        ASSIGN                                                   !7, $48
   49    74        ASSIGN                                                   !0, ''
   50    75      > JMP                                                      ->89
   51    76    >   CONCAT                                           ~51     !8, 'd'
         77        ASSIGN_OP                                     8          !0, ~51
   52    78        INIT_FCALL                                               'substr'
         79        SEND_VAR                                                 !7
         80        SEND_VAL                                                 0
         81        SEND_VAR                                                 !6
         82        DO_ICALL                                         $53     
         83        ASSIGN                                                   !8, $53
   53    84        INIT_FCALL                                               'substr'
         85        SEND_VAR                                                 !7
         86        SEND_VAR                                                 !6
         87        DO_ICALL                                         $55     
         88        ASSIGN                                                   !7, $55
   50    89    >   STRLEN                                           ~57     !8
         90        IS_EQUAL                                         ~58     !6, ~57
         91      > JMPZ_EX                                          ~58     ~58, ->95
         92    >   STRLEN                                           ~59     !7
         93        IS_SMALLER                                       ~60     0, ~59
         94        BOOL                                             ~58     ~60
         95    > > JMPNZ                                                    ~58, ->76
   55    96    >   ASSIGN_OP                                     8          !0, !8
   57    97        STRLEN                                           ~62     !0
         98        SUB                                              ~63     ~62, 1
         99        ASSIGN                                                   !2, ~63
   58   100        ASSIGN                                                   !3, ''
   59   101      > JMP                                                      ->109
   60   102    >   INIT_FCALL                                               'substr'
        103        SEND_VAR                                                 !0
        104        SEND_VAR                                                 !2
        105        SEND_VAL                                                 1
        106        DO_ICALL                                         $66     
        107        ASSIGN_OP                                     8          !3, $66
   61   108        PRE_DEC                                                  !2
   59   109    >   IS_SMALLER_OR_EQUAL                                      0, !2
        110      > JMPNZ                                                    ~69, ->102
   63   111    >   ADD                                              ~70     !6, !6
        112        ASSIGN                                                   !9, ~70
   64   113        CAST                                          6  ~72     !9
        114        ASSIGN                                                   !10, ~72
   65   115        INIT_FCALL                                               'substr'
        116        SEND_VAR                                                 !10
        117        SEND_VAL                                                 1
        118        SEND_VAL                                                 1
        119        DO_ICALL                                         $74     
        120        INIT_FCALL                                               'substr'
        121        SEND_VAR                                                 !10
        122        SEND_VAL                                                 0
        123        SEND_VAL                                                 1
        124        DO_ICALL                                         $75     
        125        CONCAT                                           ~76     $74, $75
        126        ASSIGN                                                   !11, ~76
   66   127        CONCAT                                           ~78     !11, 'A'
        128        CONCAT                                           ~79     ~78, !3
        129        CONCAT                                           ~80     ~79, 'rs'
        130        ASSIGN                                                   !3, ~80
   68   131    > > RETURN                                                   !3
   69   132*     > RETURN                                                   null

End of function reverse

Function decode_str2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 9
Branch analysis from position: 18
Branch analysis from position: 9
filename:       /in/BjLdm
function name:  decode_str2
number of ops:  24
compiled vars:  !0 = $s, !1 = $result, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   71     0  E >   RECV                                             !0      
   73     1        INIT_FCALL                                               'reverse'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'd'
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                                   !0, $3
   74     6        ASSIGN                                                   !1, ''
   75     7        ASSIGN                                                   !2, 0
          8      > JMP                                                      ->15
   76     9    >   INIT_FCALL                                               'decode_char2'
         10        FETCH_DIM_R                                      ~7      !0, !2
         11        SEND_VAL                                                 ~7
         12        DO_FCALL                                      0  $8      
         13        ASSIGN_OP                                     8          !1, $8
   75    14        PRE_INC                                                  !2
         15    >   STRLEN                                           ~11     !0
         16        IS_SMALLER                                               !2, ~11
         17      > JMPNZ                                                    ~12, ->9
   78    18    >   INIT_FCALL                                               'base64_decode'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !1, $13
   79    22      > RETURN                                                   !1
   80    23*     > RETURN                                                   null

End of function decode_str2

Function encode_str2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 8
Branch analysis from position: 17
Branch analysis from position: 8
filename:       /in/BjLdm
function name:  encode_str2
number of ops:  24
compiled vars:  !0 = $s, !1 = $result, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   82     0  E >   RECV                                             !0      
   84     1        INIT_FCALL                                               'base64_encode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
   85     5        ASSIGN                                                   !1, ''
   86     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->14
   87     8    >   INIT_FCALL                                               'decode_char2'
          9        FETCH_DIM_R                                      ~7      !0, !2
         10        SEND_VAL                                                 ~7
         11        DO_FCALL                                      0  $8      
         12        ASSIGN_OP                                     8          !1, $8
   86    13        PRE_INC                                                  !2
         14    >   STRLEN                                           ~11     !0
         15        IS_SMALLER                                               !2, ~11
         16      > JMPNZ                                                    ~12, ->8
   89    17    >   INIT_FCALL                                               'reverse'
         18        SEND_VAR                                                 !1
         19        SEND_VAL                                                 'e'
         20        DO_FCALL                                      0  $13     
         21        ASSIGN                                                   !1, $13
   90    22      > RETURN                                                   !1
   91    23*     > RETURN                                                   null

End of function encode_str2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.45 ms | 1419 KiB | 24 Q