3v4l.org

run code in 300+ PHP versions simultaneously
<?php headers_sent()?'': header('Content-Type:text/html; charset=UTF-8');?> <!DOCTYPE html><!-- (c) 2006 - 2013 Dealerdirect B.V. --> <html lang="NL"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> </head> <html> <? class Stripper{ var $regex; var $stripped; var $decoded; var $current_encoding; var $result; function __construct(){ mb_internal_encoding('UTF-8'); //mb_regex_encoding("UTF-8"); setlocale(LC_ALL, ['de_DE@euro', 'de_DE', 'deu_deu']); } private function to_utf8( $string ) { // From http://w3.org/International/questions/qa-forms-utf-8.html if ( preg_match('%^(?: [\x09\x0A\x0D\x20-\x7E] # ASCII | [\xC2-\xDF][\x80-\xBF] # non-overlong 2-byte | \xE0[\xA0-\xBF][\x80-\xBF] # excluding overlongs | [\xE1-\xEC\xEE\xEF][\x80-\xBF]{2} # straight 3-byte | \xED[\x80-\x9F][\x80-\xBF] # excluding surrogates | \xF0[\x90-\xBF][\x80-\xBF]{2} # planes 1-3 | [\xF1-\xF3][\x80-\xBF]{3} # planes 4-15 | \xF4[\x80-\x8F][\x80-\xBF]{2} # plane 16 )*$%xs', $string) ) { return $string; } else { return iconv( 'CP1252', 'UTF-8', $string); } } function convert($string, $targetEncoding = 'UTF-8'){ $current_encoding = mb_detect_encoding($string); if($current_encoding != $targetEncoding){ $string = mb_convert_encoding($string, $targetEncoding, mb_detect_encoding($string)); } $result = $string; return $result; } //this function returns characters, whitespace, underscores and linebreaks plus @ , and - function strip($string){ //$this->convert($string); $result = mb_ereg_replace("[^[:word:][:alnum:][:blank:][:space:]@,\-\.]*", "", $string); return $result; } //this function returns $digits of number and discards everything else function onlyNumbers($string, $digits=0){ //$this->convert($string); $result = mb_ereg_replace("[^\d]*", "", $string); if($digits > 0){ $result = substr($result, 0, $digits); } return $result; } function decode($string, $type="all"){ //$this->convert($string); if($type == "all" || $type == "strip"){ $string = stripslashes($string); } if ($type == "all" || $type == "decode"){ $string = urldecode($string); } $result = $string; return $result; } } //mb_detect_order ( mb_internal_encoding('UTF-8'); mb_http_output('UTF-8'); mb_http_input('UTF-8'); mb_language('uni'); mb_regex_encoding('UTF-8'); ob_start('mb_output_handler'); //var_dump(mb_regex_encoding()); //var_dump( mb_get_info()); $value = "Häslïchëräëÿüïöáéüúíóßñµç.,_-;()''\"\" "; //$value = $stripper->decode($value); //$value = $stripper->convert($value); echo "before strip :" . mb_detect_encoding($value) . " for $value<br />"; //$_POST[$key] = $purifier->purify($_POST[$key]); //$value = str_replace("ß","ss",$value); $stripper = new Stripper(); $value = $stripper->strip($value); echo "after strip :". mb_detect_encoding($value) . " for $value<br />"; //phpinfo();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QJdBH
function name:  (null)
number of ops:  56
compiled vars:  !0 = $value, !1 = $stripper
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'headers_sent'
          1        DO_ICALL                                         $2      
          2      > JMPZ                                                     $2, ->5
          3    >   QM_ASSIGN                                        ~3      ''
          4      > JMP                                                      ->9
          5    >   INIT_FCALL                                               'header'
          6        SEND_VAL                                                 'Content-Type%3Atext%2Fhtml%3B+charset%3DUTF-8'
          7        DO_ICALL                                         $4      
          8        QM_ASSIGN                                        ~3      $4
          9    >   FREE                                                     ~3
    3    10        ECHO                                                     '%3C%21DOCTYPE+html%3E%3C%21--+%28c%29+2006+-+2013+Dealerdirect+B.V.+--%3E%0A%3Chtml+lang%3D%22NL%22%3E%0A%09%3Chead%3E%0A++++++++++++++++%3Cmeta+http-equiv%3D%22content-type%22+content%3D%22text%2Fhtml%3B+charset%3Dutf-8%22+%2F%3E%0A++++++++%3C%2Fhead%3E%0A++++++++%3Chtml%3E%0A'
   76    11        INIT_FCALL                                               'mb_internal_encoding'
         12        SEND_VAL                                                 'UTF-8'
         13        DO_ICALL                                                 
   77    14        INIT_FCALL                                               'mb_http_output'
         15        SEND_VAL                                                 'UTF-8'
         16        DO_ICALL                                                 
   78    17        INIT_FCALL                                               'mb_http_input'
         18        SEND_VAL                                                 'UTF-8'
         19        DO_ICALL                                                 
   79    20        INIT_FCALL                                               'mb_language'
         21        SEND_VAL                                                 'uni'
         22        DO_ICALL                                                 
   80    23        INIT_FCALL                                               'mb_regex_encoding'
         24        SEND_VAL                                                 'UTF-8'
         25        DO_ICALL                                                 
   81    26        INIT_FCALL                                               'ob_start'
         27        SEND_VAL                                                 'mb_output_handler'
         28        DO_ICALL                                                 
   86    29        ASSIGN                                                   !0, 'H%C3%A4sl%C3%AFch%C3%ABr%C3%A4%C3%AB%C3%BF%C3%BC%C3%AF%C3%B6%C3%A1%C3%A9%C3%BC%C3%BA%C3%AD%C3%B3%C3%9F%C3%B1%C2%B5%C3%A7.%2C_-%3B%28%29%27%27%22%22+'
   91    30        INIT_FCALL                                               'mb_detect_encoding'
         31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $12     
         33        CONCAT                                           ~13     'before+strip+%3A', $12
         34        ROPE_INIT                                     3  ~15     '+for+'
         35        ROPE_ADD                                      1  ~15     ~15, !0
         36        ROPE_END                                      2  ~14     ~15, '%3Cbr+%2F%3E'
         37        CONCAT                                           ~17     ~13, ~14
         38        ECHO                                                     ~17
   94    39        NEW                                              $18     'Stripper'
         40        DO_FCALL                                      0          
         41        ASSIGN                                                   !1, $18
   95    42        INIT_METHOD_CALL                                         !1, 'strip'
         43        SEND_VAR_EX                                              !0
         44        DO_FCALL                                      0  $21     
         45        ASSIGN                                                   !0, $21
   97    46        INIT_FCALL                                               'mb_detect_encoding'
         47        SEND_VAR                                                 !0
         48        DO_ICALL                                         $23     
         49        CONCAT                                           ~24     'after+strip+%3A', $23
         50        ROPE_INIT                                     3  ~26     '+for+'
         51        ROPE_ADD                                      1  ~26     ~26, !0
         52        ROPE_END                                      2  ~25     ~26, '%3Cbr+%2F%3E'
         53        CONCAT                                           ~28     ~24, ~25
         54        ECHO                                                     ~28
   98    55      > RETURN                                                   1

Class Stripper:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QJdBH
function name:  __construct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'mb_internal_encoding'
          1        SEND_VAL                                                 'UTF-8'
          2        DO_ICALL                                                 
   19     3        INIT_FCALL                                               'setlocale'
          4        SEND_VAL                                                 6
          5        SEND_VAL                                                 <array>
          6        DO_ICALL                                                 
   20     7      > RETURN                                                   null

End of function __construct

Function to_utf8:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QJdBH
function name:  to_utf8
number of ops:  15
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%25%5E%28%3F%3A+%0A++++++++++++++++++++++%5B%5Cx09%5Cx0A%5Cx0D%5Cx20-%5Cx7E%5D++++++++++++%23+ASCII+%0A++++++++++++++++++++%7C+%5B%5CxC2-%5CxDF%5D%5B%5Cx80-%5CxBF%5D+++++++++++++%23+non-overlong+2-byte+%0A++++++++++++++++++++%7C+%5CxE0%5B%5CxA0-%5CxBF%5D%5B%5Cx80-%5CxBF%5D+++++++++%23+excluding+overlongs+%0A++++++++++++++++++++%7C+%5B%5CxE1-%5CxEC%5CxEE%5CxEF%5D%5B%5Cx80-%5CxBF%5D%7B2%7D++%23+straight+3-byte+%0A++++++++++++++++++++%7C+%5CxED%5B%5Cx80-%5Cx9F%5D%5B%5Cx80-%5CxBF%5D+++++++++%23+excluding+surrogates+%0A++++++++++++++++++++%7C+%5CxF0%5B%5Cx90-%5CxBF%5D%5B%5Cx80-%5CxBF%5D%7B2%7D++++++%23+planes+1-3+%0A++++++++++++++++++++%7C+%5B%5CxF1-%5CxF3%5D%5B%5Cx80-%5CxBF%5D%7B3%7D++++++++++%23+planes+4-15+%0A++++++++++++++++++++%7C+%5CxF4%5B%5Cx80-%5Cx8F%5D%5B%5Cx80-%5CxBF%5D%7B2%7D++++++%23+plane+16+%0A++++++++++++++++%29%2A%24%25xs'
   32     3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5      > JMPZ                                                     $1, ->8
   33     6    > > RETURN                                                   !0
          7*       JMP                                                      ->14
   35     8    >   INIT_FCALL_BY_NAME                                       'iconv'
          9        SEND_VAL_EX                                              'CP1252'
         10        SEND_VAL_EX                                              'UTF-8'
         11        SEND_VAR_EX                                              !0
         12        DO_FCALL                                      0  $2      
         13      > RETURN                                                   $2
   37    14*     > RETURN                                                   null

End of function to_utf8

Function convert:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/QJdBH
function name:  convert
number of ops:  20
compiled vars:  !0 = $string, !1 = $targetEncoding, !2 = $current_encoding, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'UTF-8'
   39     2        INIT_FCALL                                               'mb_detect_encoding'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !2, $4
   40     6        IS_NOT_EQUAL                                             !2, !1
          7      > JMPZ                                                     ~6, ->17
   41     8    >   INIT_FCALL                                               'mb_convert_encoding'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        INIT_FCALL                                               'mb_detect_encoding'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $7      
         14        SEND_VAR                                                 $7
         15        DO_ICALL                                         $8      
         16        ASSIGN                                                   !0, $8
   43    17    >   ASSIGN                                                   !3, !0
   44    18      > RETURN                                                   !3
   45    19*     > RETURN                                                   null

End of function convert

Function strip:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/QJdBH
function name:  strip
number of ops:  9
compiled vars:  !0 = $string, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   47     0  E >   RECV                                             !0      
   49     1        INIT_FCALL                                               'mb_ereg_replace'
          2        SEND_VAL                                                 '%5B%5E%5B%3Aword%3A%5D%5B%3Aalnum%3A%5D%5B%3Ablank%3A%5D%5B%3Aspace%3A%5D%40%2C%5C-%5C.%5D%2A'
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !1, $2
   50     7      > RETURN                                                   !1
   51     8*     > RETURN                                                   null

End of function strip

Function onlynumbers:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
filename:       /in/QJdBH
function name:  onlyNumbers
number of ops:  18
compiled vars:  !0 = $string, !1 = $digits, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
   55     2        INIT_FCALL                                               'mb_ereg_replace'
          3        SEND_VAL                                                 '%5B%5E%5Cd%5D%2A'
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !2, $3
   56     8        IS_SMALLER                                               0, !1
          9      > JMPZ                                                     ~5, ->16
   57    10    >   INIT_FCALL                                               'substr'
         11        SEND_VAR                                                 !2
         12        SEND_VAL                                                 0
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $6      
         15        ASSIGN                                                   !2, $6
   59    16    > > RETURN                                                   !2
   60    17*     > RETURN                                                   null

End of function onlynumbers

Function decode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
2 jumps found. (Code = 47) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 15
Branch analysis from position: 11
Branch analysis from position: 6
filename:       /in/QJdBH
function name:  decode
number of ops:  23
compiled vars:  !0 = $string, !1 = $type, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   61     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'all'
   64     2        IS_EQUAL                                         ~3      !1, 'all'
          3      > JMPNZ_EX                                         ~3      ~3, ->6
          4    >   IS_EQUAL                                         ~4      !1, 'strip'
          5        BOOL                                             ~3      ~4
          6    > > JMPZ                                                     ~3, ->11
   65     7    >   INIT_FCALL                                               'stripslashes'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        ASSIGN                                                   !0, $5
   67    11    >   IS_EQUAL                                         ~7      !1, 'all'
         12      > JMPNZ_EX                                         ~7      ~7, ->15
         13    >   IS_EQUAL                                         ~8      !1, 'decode'
         14        BOOL                                             ~7      ~8
         15    > > JMPZ                                                     ~7, ->20
   68    16    >   INIT_FCALL                                               'urldecode'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $9      
         19        ASSIGN                                                   !0, $9
   70    20    >   ASSIGN                                                   !2, !0
   71    21      > RETURN                                                   !2
   72    22*     > RETURN                                                   null

End of function decode

End of class Stripper.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
193.88 ms | 1412 KiB | 45 Q