3v4l.org

run code in 300+ PHP versions simultaneously
<?php function replace_unicode_escape_sequence($match) { var_dump($match); return mb_convert_encoding(pack('H*', $match[1]), 'UTF-8', 'UCS-2BE'); } $str = "Bal\u00edky"; $str = preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $str); echo $str;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csTPS
function name:  (null)
number of ops:  9
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, 'Bal%5Cu00edky'
    7     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%2F%5C%5Cu%28%5B0-9a-f%5D%7B4%7D%29%2Fi'
          3        SEND_VAL                                                 'replace_unicode_escape_sequence'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !0, $2
    8     7        ECHO                                                     !0
          8      > RETURN                                                   1

Function replace_unicode_escape_sequence:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/csTPS
function name:  replace_unicode_escape_sequence
number of ops:  16
compiled vars:  !0 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
    4     4        INIT_FCALL                                               'mb_convert_encoding'
          5        INIT_FCALL                                               'pack'
          6        SEND_VAL                                                 'H%2A'
          7        FETCH_DIM_R                                      ~2      !0, 1
          8        SEND_VAL                                                 ~2
          9        DO_ICALL                                         $3      
         10        SEND_VAR                                                 $3
         11        SEND_VAL                                                 'UTF-8'
         12        SEND_VAL                                                 'UCS-2BE'
         13        DO_ICALL                                         $4      
         14      > RETURN                                                   $4
    5    15*     > RETURN                                                   null

End of function replace_unicode_escape_sequence

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.7 ms | 1395 KiB | 21 Q