3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encode($str) { return str_replace(str_split('+/='), str_split('-_.'), base64_encode($str)); } function decode($str) { return base64_decode(str_replace(str_split('-_.'), str_split('+/='), $str)); } $str = "Now is the time for all good men to come to the aid of the party."; var_dump($enc = encode($str), decode($enc));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vGEWM
function name:  (null)
number of ops:  13
compiled vars:  !0 = $str, !1 = $enc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                   !0, 'Now+is+the+time+for+all+good+men+to+come+to+the+aid+of+the+party.'
    9     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'encode'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $3      
          5        ASSIGN                                           ~4      !1, $3
          6        SEND_VAL                                                 ~4
          7        INIT_FCALL                                               'decode'
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function encode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vGEWM
function name:  encode
number of ops:  17
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'str_replace'
          2        INIT_FCALL                                               'str_split'
          3        SEND_VAL                                                 '%2B%2F%3D'
          4        DO_ICALL                                         $1      
          5        SEND_VAR                                                 $1
          6        INIT_FCALL                                               'str_split'
          7        SEND_VAL                                                 '-_.'
          8        DO_ICALL                                         $2      
          9        SEND_VAR                                                 $2
         10        INIT_FCALL                                               'base64_encode'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $3      
         13        SEND_VAR                                                 $3
         14        DO_ICALL                                         $4      
         15      > RETURN                                                   $4
         16*     > RETURN                                                   null

End of function encode

Function decode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vGEWM
function name:  decode
number of ops:  17
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'base64_decode'
          2        INIT_FCALL                                               'str_replace'
          3        INIT_FCALL                                               'str_split'
          4        SEND_VAL                                                 '-_.'
          5        DO_ICALL                                         $1      
          6        SEND_VAR                                                 $1
          7        INIT_FCALL                                               'str_split'
          8        SEND_VAL                                                 '%2B%2F%3D'
          9        DO_ICALL                                         $2      
         10        SEND_VAR                                                 $2
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                         $3      
         13        SEND_VAR                                                 $3
         14        DO_ICALL                                         $4      
         15      > RETURN                                                   $4
         16*     > RETURN                                                   null

End of function decode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.12 ms | 1403 KiB | 25 Q