3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = "sea \u{200B}\u{200B}lion"; echo preg_replace_callback('#\X#u', function($m) { $utf16 = mb_convert_encoding($m[0], 'UTF-16BE', 'UTF-8'); if (strlen($utf16) <= 2) { $esc = '\u' . bin2hex($utf16); } else { $esc = '\u' . bin2hex(substr($utf16, 0, 2)) . '\u' . bin2hex(substr($utf16, 2, 2)); } return $esc; }, $input);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JRtrP
function name:  (null)
number of ops:  9
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'sea+%E2%80%8B%E2%80%8Blion'
    4     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%23%5CX%23u'
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   14     4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !0
    4     6        DO_ICALL                                         $3      
   14     7        ECHO                                                     $3
          8      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JRtrP
function name:  {closure}
number of ops:  39
compiled vars:  !0 = $m, !1 = $utf16, !2 = $esc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'mb_convert_encoding'
          2        FETCH_DIM_R                                      ~3      !0, 0
          3        SEND_VAL                                                 ~3
          4        SEND_VAL                                                 'UTF-16BE'
          5        SEND_VAL                                                 'UTF-8'
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
    6     8        STRLEN                                           ~6      !1
          9        IS_SMALLER_OR_EQUAL                                      ~6, 2
         10      > JMPZ                                                     ~7, ->17
    7    11    >   INIT_FCALL                                               'bin2hex'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                         $8      
         14        CONCAT                                           ~9      '%5Cu', $8
         15        ASSIGN                                                   !2, ~9
    6    16      > JMP                                                      ->37
   10    17    >   INIT_FCALL                                               'bin2hex'
         18        INIT_FCALL                                               'substr'
         19        SEND_VAR                                                 !1
         20        SEND_VAL                                                 0
         21        SEND_VAL                                                 2
         22        DO_ICALL                                         $11     
         23        SEND_VAR                                                 $11
         24        DO_ICALL                                         $12     
         25        CONCAT                                           ~13     '%5Cu', $12
   11    26        CONCAT                                           ~14     ~13, '%5Cu'
         27        INIT_FCALL                                               'bin2hex'
         28        INIT_FCALL                                               'substr'
         29        SEND_VAR                                                 !1
         30        SEND_VAL                                                 2
         31        SEND_VAL                                                 2
         32        DO_ICALL                                         $15     
         33        SEND_VAR                                                 $15
         34        DO_ICALL                                         $16     
         35        CONCAT                                           ~17     ~14, $16
   10    36        ASSIGN                                                   !2, ~17
   13    37    > > RETURN                                                   !2
   14    38*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.72 ms | 1018 KiB | 17 Q