3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-Type: text/html; charset=UTF-8'); $str = "<h1>He'llü & Wor&#39;ldÆØÅÅÅ!</h1>" . "\tcafé\n"; if ('UTF-8' !== mb_detect_encoding($str)) { $str = utf8_encode($str); } var_dump($str); $str = html_entity_decode($str, ENT_QUOTES | ENT_XML1, 'UTF-8'); var_dump($str); $str = filter_var(html_entity_decode($str, ENT_QUOTES | ENT_XML1, 'UTF-8'), FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_LOW | FILTER_FLAG_STRIP_HIGH | FILTER_FLAG_NO_ENCODE_QUOTES); var_dump($str); #$newstr = preg_replace('/\s[\s]+/', ' ', $str); // Strip off multiple spaces $newstr = preg_replace('/[^\000-\128]+/', '', $str); // Strip off non-alpha-numeric #$newstr = preg_replace('/[\s\W]+/', '-', $newstr); // Strip off spaces and non-alpha-numeric #$newstr = preg_replace('/[^A-Za-z0-9_-]+/', '', $newstr); var_dump($newstr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 13
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/mbs0r
function name:  (null)
number of ops:  49
compiled vars:  !0 = $str, !1 = $newstr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'header'
          1        SEND_VAL                                                 'Content-Type%3A+text%2Fhtml%3B+charset%3DUTF-8'
          2        DO_ICALL                                                 
    4     3        ASSIGN                                                   !0, '%3Ch1%3EHe%27ll%C3%BC+%26+Wor%26%2339%3Bld%C3%86%C3%98%C3%85%C3%85%C3%85%21%3C%2Fh1%3E%09caf%C3%A9%0A'
    5     4        INIT_FCALL                                               'mb_detect_encoding'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $4      
          7        IS_NOT_IDENTICAL                                         $4, 'UTF-8'
          8      > JMPZ                                                     ~5, ->13
    6     9    >   INIT_FCALL                                               'utf8_encode'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !0, $6
    8    13    >   INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
   10    16        INIT_FCALL                                               'html_entity_decode'
         17        SEND_VAR                                                 !0
         18        SEND_VAL                                                 19
         19        SEND_VAL                                                 'UTF-8'
         20        DO_ICALL                                         $9      
         21        ASSIGN                                                   !0, $9
   11    22        INIT_FCALL                                               'var_dump'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
   13    25        INIT_FCALL                                               'filter_var'
         26        INIT_FCALL                                               'html_entity_decode'
         27        SEND_VAR                                                 !0
         28        SEND_VAL                                                 19
         29        SEND_VAL                                                 'UTF-8'
         30        DO_ICALL                                         $12     
         31        SEND_VAR                                                 $12
   14    32        SEND_VAL                                                 513
         33        SEND_VAL                                                 140
         34        DO_ICALL                                         $13     
   13    35        ASSIGN                                                   !0, $13
   15    36        INIT_FCALL                                               'var_dump'
         37        SEND_VAR                                                 !0
         38        DO_ICALL                                                 
   18    39        INIT_FCALL                                               'preg_replace'
         40        SEND_VAL                                                 '%2F%5B%5E%5C000-%5C128%5D%2B%2F'
         41        SEND_VAL                                                 ''
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                         $16     
         44        ASSIGN                                                   !1, $16
   22    45        INIT_FCALL                                               'var_dump'
         46        SEND_VAR                                                 !1
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.3 ms | 1400 KiB | 27 Q