3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = '/dav/files/admin/%C3%BC%C3%B6%C3%A4%C3%B6%C3%A4%C3%BC%C3%B6%C3%A4%C3%BB%C5%B7%C3%AE'; /** * Decodes a url-encoded path segment. */ function decodePathSegment(string $path): string { $path = rawurldecode($path); $encoding = mb_detect_encoding($path, ['UTF-8', 'ISO-8859-1']); switch ($encoding) { case 'ISO-8859-1': $path = utf8_encode($path); } return $path; } var_dump( decodePathSegment($str));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IT9dJ
function name:  (null)
number of ops:  8
compiled vars:  !0 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%2Fdav%2Ffiles%2Fadmin%2F%25C3%25BC%25C3%25B6%25C3%25A4%25C3%25B6%25C3%25A4%25C3%25BC%25C3%25B6%25C3%25A4%25C3%25BB%25C5%25B7%25C3%25AE'
   21     1        INIT_FCALL                                                   'var_dump'
   22     2        INIT_FCALL                                                   'decodepathsegment'
          3        SEND_VAR                                                     !0
          4        DO_FCALL                                          0  $2      
          5        SEND_VAR                                                     $2
   21     6        DO_ICALL                                                     
   22     7      > RETURN                                                       1

Function decodepathsegment:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IT9dJ
function name:  decodePathSegment
number of ops:  21
compiled vars:  !0 = $path, !1 = $encoding
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   RECV                                                 !0      
   10     1        INIT_FCALL                                                   'rawurldecode'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $2      
          4        ASSIGN                                                       !0, $2
   11     5        INIT_FCALL                                                   'mb_detect_encoding'
          6        SEND_VAR                                                     !0
          7        SEND_VAL                                                     <array>
          8        DO_ICALL                                             $4      
          9        ASSIGN                                                       !1, $4
   14    10        IS_EQUAL                                                     !1, 'ISO-8859-1'
         11      > JMPNZ                                                        ~6, ->13
         12    > > JMP                                                          ->17
   15    13    >   INIT_FCALL                                                   'utf8_encode'
         14        SEND_VAR                                                     !0
         15        DO_FCALL_BY_NAME                                             
         16        ASSIGN                                                       !0, $7
   18    17    >   VERIFY_RETURN_TYPE                                           !0
         18      > RETURN                                                       !0
   19    19*       VERIFY_RETURN_TYPE                                           
         20*     > RETURN                                                       null

End of function decodepathsegment

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
158.86 ms | 1883 KiB | 18 Q