3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo preg_replace_callback("#%u([0-9A-F]{1,4})#i", create_function('$matches', 'return dec_to_utf8(hexdec($matches[1]));'), '%u01C4'); function dec_to_utf8($src) { $dest = ''; if($src < 0) { return false; } elseif($src <= 0x007f) { $dest .= chr($src); } elseif($src <= 0x07ff) { $dest .= chr(0xc0 | ($src >> 6)); $dest .= chr(0x80 | ($src & 0x003f)); } elseif($src <= 0xffff) { $dest .= chr(0xe0 | ($src >> 12)); $dest .= chr(0x80 | (($src >> 6) & 0x003f)); $dest .= chr(0x80 | ($src & 0x003f)); } elseif($src <= 0x10ffff) { $dest .= chr(0xf0 | ($src >> 18)); $dest .= chr(0x80 | (($src >> 12) & 0x3f)); $dest .= chr(0x80 | (($src >> 6) & 0x3f)); $dest .= chr(0x80 | ($src & 0x3f)); } else { // Out of range return false; } return $dest; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ghsKS
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'preg_replace_callback'
          1        SEND_VAL                                                 '%23%25u%28%5B0-9A-F%5D%7B1%2C4%7D%29%23i'
          2        INIT_FCALL_BY_NAME                                       'create_function'
          3        SEND_VAL_EX                                              '%24matches'
          4        SEND_VAL_EX                                              'return+dec_to_utf8%28hexdec%28%24matches%5B1%5D%29%29%3B'
          5        DO_FCALL                                      0  $0      
          6        SEND_VAR                                                 $0
          7        SEND_VAL                                                 '%25u01C4'
          8        DO_ICALL                                         $1      
          9        ECHO                                                     $1
   42    10      > RETURN                                                   1

Function dec_to_utf8:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 28
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 50
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
Branch analysis from position: 50
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 79
Branch analysis from position: 52
1 jumps found. (Code = 42) Position 1 = 80
Branch analysis from position: 80
Branch analysis from position: 79
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ghsKS
function name:  dec_to_utf8
number of ops:  82
compiled vars:  !0 = $src, !1 = $dest
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    7     1        ASSIGN                                                   !1, ''
    9     2        IS_SMALLER                                               !0, 0
          3      > JMPZ                                                     ~3, ->6
   11     4    > > RETURN                                                   <false>
          5*       JMP                                                      ->80
   13     6    >   IS_SMALLER_OR_EQUAL                                      !0, 127
          7      > JMPZ                                                     ~4, ->13
   15     8    >   INIT_FCALL                                               'chr'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $5      
         11        ASSIGN_OP                                     8          !1, $5
         12      > JMP                                                      ->80
   17    13    >   IS_SMALLER_OR_EQUAL                                      !0, 2047
         14      > JMPZ                                                     ~7, ->28
   19    15    >   INIT_FCALL                                               'chr'
         16        SR                                               ~8      !0, 6
         17        BW_OR                                            ~9      ~8, 192
         18        SEND_VAL                                                 ~9
         19        DO_ICALL                                         $10     
         20        ASSIGN_OP                                     8          !1, $10
   20    21        INIT_FCALL                                               'chr'
         22        BW_AND                                           ~12     !0, 63
         23        BW_OR                                            ~13     ~12, 128
         24        SEND_VAL                                                 ~13
         25        DO_ICALL                                         $14     
         26        ASSIGN_OP                                     8          !1, $14
         27      > JMP                                                      ->80
   22    28    >   IS_SMALLER_OR_EQUAL                                      !0, 65535
         29      > JMPZ                                                     ~16, ->50
   24    30    >   INIT_FCALL                                               'chr'
         31        SR                                               ~17     !0, 12
         32        BW_OR                                            ~18     ~17, 224
         33        SEND_VAL                                                 ~18
         34        DO_ICALL                                         $19     
         35        ASSIGN_OP                                     8          !1, $19
   25    36        INIT_FCALL                                               'chr'
         37        SR                                               ~21     !0, 6
         38        BW_AND                                           ~22     ~21, 63
         39        BW_OR                                            ~23     ~22, 128
         40        SEND_VAL                                                 ~23
         41        DO_ICALL                                         $24     
         42        ASSIGN_OP                                     8          !1, $24
   26    43        INIT_FCALL                                               'chr'
         44        BW_AND                                           ~26     !0, 63
         45        BW_OR                                            ~27     ~26, 128
         46        SEND_VAL                                                 ~27
         47        DO_ICALL                                         $28     
         48        ASSIGN_OP                                     8          !1, $28
         49      > JMP                                                      ->80
   28    50    >   IS_SMALLER_OR_EQUAL                                      !0, 1114111
         51      > JMPZ                                                     ~30, ->79
   30    52    >   INIT_FCALL                                               'chr'
         53        SR                                               ~31     !0, 18
         54        BW_OR                                            ~32     ~31, 240
         55        SEND_VAL                                                 ~32
         56        DO_ICALL                                         $33     
         57        ASSIGN_OP                                     8          !1, $33
   31    58        INIT_FCALL                                               'chr'
         59        SR                                               ~35     !0, 12
         60        BW_AND                                           ~36     ~35, 63
         61        BW_OR                                            ~37     ~36, 128
         62        SEND_VAL                                                 ~37
         63        DO_ICALL                                         $38     
         64        ASSIGN_OP                                     8          !1, $38
   32    65        INIT_FCALL                                               'chr'
         66        SR                                               ~40     !0, 6
         67        BW_AND                                           ~41     ~40, 63
         68        BW_OR                                            ~42     ~41, 128
         69        SEND_VAL                                                 ~42
         70        DO_ICALL                                         $43     
         71        ASSIGN_OP                                     8          !1, $43
   33    72        INIT_FCALL                                               'chr'
         73        BW_AND                                           ~45     !0, 63
         74        BW_OR                                            ~46     ~45, 128
         75        SEND_VAL                                                 ~46
         76        DO_ICALL                                         $47     
         77        ASSIGN_OP                                     8          !1, $47
         78      > JMP                                                      ->80
   38    79    > > RETURN                                                   <false>
   41    80    > > RETURN                                                   !1
   42    81*     > RETURN                                                   null

End of function dec_to_utf8

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.96 ms | 1404 KiB | 20 Q