3v4l.org

run code in 300+ PHP versions simultaneously
<?php function urlRawDecode($raw_url_encoded) { # Hex conversion table $hex_table = array( 0 => 0x00, 1 => 0x01, 2 => 0x02, 3 => 0x03, 4 => 0x04, 5 => 0x05, 6 => 0x06, 7 => 0x07, 8 => 0x08, 9 => 0x09, "A"=> 0x0a, "B"=> 0x0b, "C"=> 0x0c, "D"=> 0x0d, "E"=> 0x0e, "F"=> 0x0f ); # Fixin' latin character problem if(preg_match_all("/\%C3\%([A-Z0-9]{2})/i", $raw_url_encoded,$res)) { $res = array_unique($res = $res[1]); $arr_unicoded = array(); foreach($res as $key => $value){ $arr_unicoded[] = chr( (0xc0 | ($hex_table[substr($value,0,1)]<<4)) | (0x03 & $hex_table[substr($value,1,1)]) ); $res[$key] = "%C3%" . $value; } $raw_url_encoded = str_replace( $res, $arr_unicoded, $raw_url_encoded ); } # Return decoded raw url encoded data return rawurldecode($raw_url_encoded); } print urlRawDecode("%C3%A1%C3%B1"); // output: // áñ ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KWB4J
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   48     0  E >   INIT_FCALL                                               'urlrawdecode'
          1        SEND_VAL                                                 '%25C3%25A1%25C3%25B1'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
   53     4      > RETURN                                                   1

Function urlrawdecode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 50
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 43
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 43
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 50
filename:       /in/KWB4J
function name:  urlRawDecode
number of ops:  55
compiled vars:  !0 = $raw_url_encoded, !1 = $hex_table, !2 = $res, !3 = $arr_unicoded, !4 = $value, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
   25     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAL                                                 '%2F%5C%25C3%5C%25%28%5BA-Z0-9%5D%7B2%7D%29%2Fi'
          4        SEND_VAR                                                 !0
          5        SEND_REF                                                 !2
          6        DO_ICALL                                         $7      
          7      > JMPZ                                                     $7, ->50
   27     8    >   INIT_FCALL                                               'array_unique'
          9        FETCH_DIM_R                                      ~8      !2, 1
         10        ASSIGN                                           ~9      !2, ~8
         11        SEND_VAL                                                 ~9
         12        DO_ICALL                                         $10     
         13        ASSIGN                                                   !2, $10
   28    14        ASSIGN                                                   !3, <array>
   29    15      > FE_RESET_R                                       $13     !2, ->43
         16    > > FE_FETCH_R                                       ~14     $13, !4, ->43
         17    >   ASSIGN                                                   !5, ~14
   30    18        INIT_FCALL                                               'chr'
   31    19        INIT_FCALL                                               'substr'
         20        SEND_VAR                                                 !4
         21        SEND_VAL                                                 0
         22        SEND_VAL                                                 1
         23        DO_ICALL                                         $17     
         24        FETCH_DIM_R                                      ~18     !1, $17
         25        SL                                               ~19     ~18, 4
         26        BW_OR                                            ~20     ~19, 192
   32    27        INIT_FCALL                                               'substr'
         28        SEND_VAR                                                 !4
         29        SEND_VAL                                                 1
         30        SEND_VAL                                                 1
         31        DO_ICALL                                         $21     
         32        FETCH_DIM_R                                      ~22     !1, $21
         33        BW_AND                                           ~23     ~22, 3
         34        BW_OR                                            ~24     ~20, ~23
         35        SEND_VAL                                                 ~24
         36        DO_ICALL                                         $25     
   30    37        ASSIGN_DIM                                               !3
   32    38        OP_DATA                                                  $25
   34    39        CONCAT                                           ~27     '%25C3%25', !4
         40        ASSIGN_DIM                                               !2, !5
         41        OP_DATA                                                  ~27
   29    42      > JMP                                                      ->16
         43    >   FE_FREE                                                  $13
   37    44        INIT_FCALL                                               'str_replace'
   38    45        SEND_VAR                                                 !2
   39    46        SEND_VAR                                                 !3
   40    47        SEND_VAR                                                 !0
         48        DO_ICALL                                         $28     
   37    49        ASSIGN                                                   !0, $28
   45    50    >   INIT_FCALL                                               'rawurldecode'
         51        SEND_VAR                                                 !0
         52        DO_ICALL                                         $30     
         53      > RETURN                                                   $30
   46    54*     > RETURN                                                   null

End of function urlrawdecode

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.6 ms | 1407 KiB | 26 Q