3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = "\xC2<script+%C2>alert(1);//%C2</script+%C2>"; function mb_htmlescape($s) { mb_regex_encoding('UTF-8'); $s = mb_ereg_replace('&', '&amp;', $s); $s = mb_ereg_replace('<', '&lt;', $s); $s = mb_ereg_replace('>', '&gt;', $s); $s = mb_ereg_replace('"', '&quot;', $s); return $s; } echo mb_htmlescape($x); echo htmlspecialchars($x);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5oZMS
function name:  (null)
number of ops:  10
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%C2%3Cscript%2B%25C2%3Ealert%281%29%3B%2F%2F%25C2%3C%2Fscript%2B%25C2%3E'
   11     1        INIT_FCALL                                               'mb_htmlescape'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   12     5        INIT_FCALL                                               'htmlspecialchars'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        ECHO                                                     $3
          9      > RETURN                                                   1

Function mb_htmlescape:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5oZMS
function name:  mb_htmlescape
number of ops:  30
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'mb_regex_encoding'
          2        SEND_VAL                                                 'UTF-8'
          3        DO_ICALL                                                 
    5     4        INIT_FCALL                                               'mb_ereg_replace'
          5        SEND_VAL                                                 '%26'
          6        SEND_VAL                                                 '%26amp%3B'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $2      
          9        ASSIGN                                                   !0, $2
    6    10        INIT_FCALL                                               'mb_ereg_replace'
         11        SEND_VAL                                                 '%3C'
         12        SEND_VAL                                                 '%26lt%3B'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $4      
         15        ASSIGN                                                   !0, $4
    7    16        INIT_FCALL                                               'mb_ereg_replace'
         17        SEND_VAL                                                 '%3E'
         18        SEND_VAL                                                 '%26gt%3B'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                         $6      
         21        ASSIGN                                                   !0, $6
    8    22        INIT_FCALL                                               'mb_ereg_replace'
         23        SEND_VAL                                                 '%22'
         24        SEND_VAL                                                 '%26quot%3B'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                         $8      
         27        ASSIGN                                                   !0, $8
    9    28      > RETURN                                                   !0
   10    29*     > RETURN                                                   null

End of function mb_htmlescape

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
183.63 ms | 1403 KiB | 20 Q