3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Stripper{ private $regex; private $stripped; private $decoded; private $current_encoding; private $result; function __construct(){ mb_internal_encoding('UTF-8'); //mb_regex_encoding("UTF-8"); setlocale(LC_ALL, 'de_DE@euro', 'de_DE', 'deu_deu'); } 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("[^\w\s@,\-\.]*", "", $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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/94rFY
function name:  (null)
number of ops:  45
compiled vars:  !0 = $value, !1 = $stripper
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   53     0  E >   INIT_FCALL                                               'mb_internal_encoding'
          1        SEND_VAL                                                 'UTF-8'
          2        DO_ICALL                                                 
   54     3        INIT_FCALL                                               'mb_http_output'
          4        SEND_VAL                                                 'UTF-8'
          5        DO_ICALL                                                 
   55     6        INIT_FCALL                                               'mb_http_input'
          7        SEND_VAL                                                 'UTF-8'
          8        DO_ICALL                                                 
   56     9        INIT_FCALL                                               'mb_language'
         10        SEND_VAL                                                 'uni'
         11        DO_ICALL                                                 
   57    12        INIT_FCALL                                               'mb_regex_encoding'
         13        SEND_VAL                                                 'UTF-8'
         14        DO_ICALL                                                 
   58    15        INIT_FCALL                                               'ob_start'
         16        SEND_VAL                                                 'mb_output_handler'
         17        DO_ICALL                                                 
   63    18        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+'
   68    19        INIT_FCALL                                               'mb_detect_encoding'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $9      
         22        CONCAT                                           ~10     'before+strip+%3A', $9
         23        ROPE_INIT                                     3  ~12     '+for+'
         24        ROPE_ADD                                      1  ~12     ~12, !0
         25        ROPE_END                                      2  ~11     ~12, '%3Cbr+%2F%3E'
         26        CONCAT                                           ~14     ~10, ~11
         27        ECHO                                                     ~14
   71    28        NEW                                              $15     'Stripper'
         29        DO_FCALL                                      0          
         30        ASSIGN                                                   !1, $15
   72    31        INIT_METHOD_CALL                                         !1, 'strip'
         32        SEND_VAR_EX                                              !0
         33        DO_FCALL                                      0  $18     
         34        ASSIGN                                                   !0, $18
   74    35        INIT_FCALL                                               'mb_detect_encoding'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $20     
         38        CONCAT                                           ~21     'after+strip+%3A', $20
         39        ROPE_INIT                                     3  ~23     '+for+'
         40        ROPE_ADD                                      1  ~23     ~23, !0
         41        ROPE_END                                      2  ~22     ~23, '%3Cbr+%2F%3E'
         42        CONCAT                                           ~25     ~21, ~22
         43        ECHO                                                     ~25
   75    44      > RETURN                                                   1

Class Stripper:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/94rFY
function name:  __construct
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   INIT_FCALL                                               'mb_internal_encoding'
          1        SEND_VAL                                                 'UTF-8'
          2        DO_ICALL                                                 
   12     3        INIT_FCALL                                               'setlocale'
          4        SEND_VAL                                                 6
          5        SEND_VAL                                                 'de_DE%40euro'
          6        SEND_VAL                                                 'de_DE'
          7        SEND_VAL                                                 'deu_deu'
          8        DO_ICALL                                                 
   13     9      > RETURN                                                   null

End of function __construct

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/94rFY
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
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'UTF-8'
   16     2        INIT_FCALL                                               'mb_detect_encoding'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !2, $4
   17     6        IS_NOT_EQUAL                                             !2, !1
          7      > JMPZ                                                     ~6, ->17
   18     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
   20    17    >   ASSIGN                                                   !3, !0
   21    18      > RETURN                                                   !3
   22    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/94rFY
function name:  strip
number of ops:  9
compiled vars:  !0 = $string, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   26     1        INIT_FCALL                                               'mb_ereg_replace'
          2        SEND_VAL                                                 '%5B%5E%5Cw%5Cs%40%2C%5C-%5C.%5D%2A'
          3        SEND_VAL                                                 ''
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6        ASSIGN                                                   !1, $2
   27     7      > RETURN                                                   !1
   28     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/94rFY
function name:  onlyNumbers
number of ops:  18
compiled vars:  !0 = $string, !1 = $digits, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      0
   32     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
   33     8        IS_SMALLER                                               0, !1
          9      > JMPZ                                                     ~5, ->16
   34    10    >   INIT_FCALL                                               'substr'
         11        SEND_VAR                                                 !2
         12        SEND_VAL                                                 0
         13        SEND_VAR                                                 !1
         14        DO_ICALL                                         $6      
         15        ASSIGN                                                   !2, $6
   36    16    > > RETURN                                                   !2
   37    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/94rFY
function name:  decode
number of ops:  23
compiled vars:  !0 = $string, !1 = $type, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      'all'
   41     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
   42     7    >   INIT_FCALL                                               'stripslashes'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $5      
         10        ASSIGN                                                   !0, $5
   44    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
   45    16    >   INIT_FCALL                                               'urldecode'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                         $9      
         19        ASSIGN                                                   !0, $9
   47    20    >   ASSIGN                                                   !2, !0
   48    21      > RETURN                                                   !2
   49    22*     > RETURN                                                   null

End of function decode

End of class Stripper.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.05 ms | 1408 KiB | 39 Q