3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = 'Happy^ hour^ / is fun //'; function filenameEncode($possible_filename){ $fngood = str_replace(array('^',';','/',':'), array('^^',';;','^',';'), $possible_filename); return $fngood; } function filenameDecode($possible_filename){ $fngood = str_replace(array('^',';','^^',';;'), array('^',';','/',':'), $possible_filename); return $fngood; } echo $s."\n"; $t = filenameEncode($s); $u = filenameDecode($t); echo $t."\n"; echo $u."\n"; if ($s === $u){ echo 'test passed'; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 18
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/SnTqF
function name:  (null)
number of ops:  19
compiled vars:  !0 = $s, !1 = $t, !2 = $u
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Happy%5E+hour%5E+%2F+is+fun+%2F%2F'
   16     1        CONCAT                                           ~4      !0, '%0A'
          2        ECHO                                                     ~4
   18     3        INIT_FCALL                                               'filenameencode'
          4        SEND_VAR                                                 !0
          5        DO_FCALL                                      0  $5      
          6        ASSIGN                                                   !1, $5
   20     7        INIT_FCALL                                               'filenamedecode'
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $7      
         10        ASSIGN                                                   !2, $7
   22    11        CONCAT                                           ~9      !1, '%0A'
         12        ECHO                                                     ~9
   23    13        CONCAT                                           ~10     !2, '%0A'
         14        ECHO                                                     ~10
   25    15        IS_IDENTICAL                                             !0, !2
         16      > JMPZ                                                     ~11, ->18
   26    17    >   ECHO                                                     'test+passed'
   27    18    > > RETURN                                                   1

Function filenameencode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SnTqF
function name:  filenameEncode
number of ops:  9
compiled vars:  !0 = $possible_filename, !1 = $fngood
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 <array>
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !1, $2
    7     7      > RETURN                                                   !1
    8     8*     > RETURN                                                   null

End of function filenameencode

Function filenamedecode:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SnTqF
function name:  filenameDecode
number of ops:  9
compiled vars:  !0 = $possible_filename, !1 = $fngood
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'str_replace'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 <array>
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !1, $2
   12     7      > RETURN                                                   !1
   13     8*     > RETURN                                                   null

End of function filenamedecode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.25 ms | 1403 KiB | 17 Q