3v4l.org

run code in 300+ PHP versions simultaneously
<?php $crap = "\u200e\u206a\u200f\u200e\u202d\u206f\u200c\u206a\u202c\u202b\u200f\u206f\u202b\u206e\u206e\u202b\u206e\u202e\u206c\u202b\u206d\u200e\u202a\u206d\u200b\u206c\u206a\u202e\u206b\u200b\u200f\u200b\u202d\u202d\u206f\u206b\u200c\u206a\u206f\u206b\u202e"; function charset_decode_utf_8 ($string) { /* Only do the slow convert if there are 8-bit characters */ /* avoid using 0xA0 (\240) in ereg ranges. RH73 does not like that */ if (!preg_match("/[\200-\237]/", $string) && !preg_match("/[\241-\377]/", $string) ) { return $string; } // decode three byte unicode characters $string = preg_replace("/([\340-\357])([\200-\277])([\200-\277])/e", "'&#'.((ord('\\1')-224)*4096 + (ord('\\2')-128)*64 + (ord('\\3')-128)).';'", $string ); // decode two byte unicode characters $string = preg_replace("/([\300-\337])([\200-\277])/e", "'&#'.((ord('\\1')-192)*64+(ord('\\2')-128)).';'", $string ); return $string; } $str = charset_decode_utf_8($crap); echo $str;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZYktb
function name:  (null)
number of ops:  7
compiled vars:  !0 = $crap, !1 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%5Cu200e%5Cu206a%5Cu200f%5Cu200e%5Cu202d%5Cu206f%5Cu200c%5Cu206a%5Cu202c%5Cu202b%5Cu200f%5Cu206f%5Cu202b%5Cu206e%5Cu206e%5Cu202b%5Cu206e%5Cu202e%5Cu206c%5Cu202b%5Cu206d%5Cu200e%5Cu202a%5Cu206d%5Cu200b%5Cu206c%5Cu206a%5Cu202e%5Cu206b%5Cu200b%5Cu200f%5Cu200b%5Cu202d%5Cu202d%5Cu206f%5Cu206b%5Cu200c%5Cu206a%5Cu206f%5Cu206b%5Cu202e'
   28     1        INIT_FCALL                                               'charset_decode_utf_8'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   29     5        ECHO                                                     !1
          6      > RETURN                                                   1

Function charset_decode_utf_8:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/ZYktb
function name:  charset_decode_utf_8
number of ops:  29
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%5B%80-%9F%5D%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5        BOOL_NOT                                         ~2      $1
          6      > JMPZ_EX                                          ~2      ~2, ->13
    7     7    >   INIT_FCALL                                               'preg_match'
          8        SEND_VAL                                                 '%2F%5B%A1-%FF%5D%2F'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $3      
         11        BOOL_NOT                                         ~4      $3
         12        BOOL                                             ~2      ~4
         13    > > JMPZ                                                     ~2, ->15
    9    14    > > RETURN                                                   !0
   13    15    >   INIT_FCALL                                               'preg_replace'
         16        SEND_VAL                                                 '%2F%28%5B%E0-%EF%5D%29%28%5B%80-%BF%5D%29%28%5B%80-%BF%5D%29%2Fe'
   14    17        SEND_VAL                                                 '%27%26%23%27.%28%28ord%28%27%5C1%27%29-224%29%2A4096+%2B+%28ord%28%27%5C2%27%29-128%29%2A64+%2B+%28ord%28%27%5C3%27%29-128%29%29.%27%3B%27'
   15    18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $5      
   13    20        ASSIGN                                                   !0, $5
   19    21        INIT_FCALL                                               'preg_replace'
         22        SEND_VAL                                                 '%2F%28%5B%C0-%DF%5D%29%28%5B%80-%BF%5D%29%2Fe'
   20    23        SEND_VAL                                                 '%27%26%23%27.%28%28ord%28%27%5C1%27%29-192%29%2A64%2B%28ord%28%27%5C2%27%29-128%29%29.%27%3B%27'
   21    24        SEND_VAR                                                 !0
         25        DO_ICALL                                         $7      
   19    26        ASSIGN                                                   !0, $7
   24    27      > RETURN                                                   !0
   25    28*     > RETURN                                                   null

End of function charset_decode_utf_8

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.85 ms | 1403 KiB | 18 Q