3v4l.org

run code in 500+ PHP versions simultaneously
<?php function emoji_to_unicode($emoji) { if (mb_ord($emoji) < 256) return $emoji; $emoji = mb_convert_encoding($emoji, 'UTF-32', 'UTF-8'); $unicode = strtoupper(preg_replace("/^[0]{3}/","U+",bin2hex($emoji))); return $unicode; } $var = ("😀x😀hello"); $out = ''; for ($i = 0; $i < mb_strlen($var); $i++) { $out .= emoji_to_unicode(mb_substr($var, $i, 1)); } echo "$out\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 4
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 4
Branch analysis from position: 19
Branch analysis from position: 4
filename:       /in/bPcGC
function name:  (null)
number of ops:  23
compiled vars:  !0 = $var, !1 = $out, !2 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                       !0, '%F0%9F%98%80x%F0%9F%98%80hello'
   12     1        ASSIGN                                                       !1, ''
   13     2        ASSIGN                                                       !2, 0
          3      > JMP                                                          ->14
   14     4    >   INIT_FCALL                                                   'emoji_to_unicode'
          5        INIT_FCALL                                                   'mb_substr'
          6        SEND_VAR                                                     !0
          7        SEND_VAR                                                     !2
          8        SEND_VAL                                                     1
          9        DO_ICALL                                             $6      
         10        SEND_VAR                                                     $6
         11        DO_FCALL                                          0  $7      
         12        ASSIGN_OP                                         8          !1, $7
   13    13        PRE_INC                                                      !2
         14    >   INIT_FCALL                                                   'mb_strlen'
         15        SEND_VAR                                                     !0
         16        DO_ICALL                                             $10     
         17        IS_SMALLER                                                   !2, $10
         18      > JMPNZ                                                        ~11, ->4
   16    19    >   NOP                                                          
         20        FAST_CONCAT                                          ~12     !1, '%0A'
         21        ECHO                                                         ~12
         22      > RETURN                                                       1

Function emoji_to_unicode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bPcGC
function name:  emoji_to_unicode
number of ops:  24
compiled vars:  !0 = $emoji, !1 = $unicode
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    4     1        INIT_FCALL                                                   'mb_ord'
          2        SEND_VAR                                                     !0
          3        DO_ICALL                                             $2      
          4        IS_SMALLER                                                   $2, 256
          5      > JMPZ                                                         ~3, ->7
          6    > > RETURN                                                       !0
    5     7    >   INIT_FCALL                                                   'mb_convert_encoding'
          8        SEND_VAR                                                     !0
          9        SEND_VAL                                                     'UTF-32'
         10        SEND_VAL                                                     'UTF-8'
         11        DO_ICALL                                             $4      
         12        ASSIGN                                                       !0, $4
    6    13        INIT_FCALL                                                   'strtoupper'
         14        INIT_FCALL                                                   'bin2hex'
         15        SEND_VAR                                                     !0
         16        DO_ICALL                                             $6      
         17        FRAMELESS_ICALL_3                preg_replace        ~7      '%2F%5E%5B0%5D%7B3%7D%2F', 'U%2B'
         18        OP_DATA                                                      $6
         19        SEND_VAL                                                     ~7
         20        DO_ICALL                                             $8      
         21        ASSIGN                                                       !1, $8
    7    22      > RETURN                                                       !1
    8    23*     > RETURN                                                       null

End of function emoji_to_unicode

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.08 ms | 2301 KiB | 20 Q