3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gdr_encode($val) { $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!='; $base = strlen($chars); $str = ''; while ($val > 0) { $str .= $chars[$val % $base]; $val = (int)($val / $base); } return $str; } function gdr_decode($str) { $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!='; $base = strlen($chars); $map = array(); for ($i=0; $i<$base; $i++) { $map[$chars[$i]] = $i; } $val = 0; for ($i=0; $i<strlen($str); $i++) { $val *= $base; $val += (int)$map[$str[$i]]; } return $val; } echo gdr_decode("8====D");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QcTaj
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'gdr_decode'
          1        SEND_VAL                                                 '8%3D%3D%3D%3DD'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function gdr_encode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 6
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 6
Branch analysis from position: 14
Branch analysis from position: 6
filename:       /in/QcTaj
function name:  gdr_encode
number of ops:  16
compiled vars:  !0 = $val, !1 = $chars, !2 = $base, !3 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%21%3D'
    5     2        STRLEN                                           ~5      !1
          3        ASSIGN                                                   !2, ~5
    6     4        ASSIGN                                                   !3, ''
    7     5      > JMP                                                      ->12
    8     6    >   MOD                                              ~8      !0, !2
          7        FETCH_DIM_R                                      ~9      !1, ~8
          8        ASSIGN_OP                                     8          !3, ~9
    9     9        DIV                                              ~11     !0, !2
         10        CAST                                          4  ~12     ~11
         11        ASSIGN                                                   !0, ~12
    7    12    >   IS_SMALLER                                               0, !0
         13      > JMPNZ                                                    ~14, ->6
   11    14    > > RETURN                                                   !3
   12    15*     > RETURN                                                   null

End of function gdr_encode

Function gdr_decode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 16
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 16
Branch analysis from position: 25
Branch analysis from position: 16
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
Branch analysis from position: 7
filename:       /in/QcTaj
function name:  gdr_decode
number of ops:  27
compiled vars:  !0 = $str, !1 = $chars, !2 = $base, !3 = $map, !4 = $i, !5 = $val
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        ASSIGN                                                   !1, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789%21%3D'
   16     2        STRLEN                                           ~7      !1
          3        ASSIGN                                                   !2, ~7
   17     4        ASSIGN                                                   !3, <array>
   18     5        ASSIGN                                                   !4, 0
          6      > JMP                                                      ->11
   19     7    >   FETCH_DIM_R                                      ~11     !1, !4
          8        ASSIGN_DIM                                               !3, ~11
          9        OP_DATA                                                  !4
   18    10        PRE_INC                                                  !4
         11    >   IS_SMALLER                                               !4, !2
         12      > JMPNZ                                                    ~14, ->7
   21    13    >   ASSIGN                                                   !5, 0
   22    14        ASSIGN                                                   !4, 0
         15      > JMP                                                      ->22
   23    16    >   ASSIGN_OP                                     3          !5, !2
   24    17        FETCH_DIM_R                                      ~18     !0, !4
         18        FETCH_DIM_R                                      ~19     !3, ~18
         19        CAST                                          4  ~20     ~19
         20        ASSIGN_OP                                     1          !5, ~20
   22    21        PRE_INC                                                  !4
         22    >   STRLEN                                           ~23     !0
         23        IS_SMALLER                                               !4, ~23
         24      > JMPNZ                                                    ~24, ->16
   26    25    > > RETURN                                                   !5
   27    26*     > RETURN                                                   null

End of function gdr_decode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.05 ms | 1403 KiB | 14 Q