3v4l.org

run code in 300+ PHP versions simultaneously
<?php function filter_input_utf8($type, $default = array()) { static $is_recursive_static = false; $is_recursive = $is_recursive_static; if (!$is_recursive_static) { $types = array( INPUT_GET => $_GET, INPUT_POST => $_POST, INPUT_COOKIE => $_COOKIE, INPUT_REQUEST => $_REQUEST, INPUT_ENV => $_ENV, INPUT_SERVER => $_SERVER, ); if (!isset($types[$type])) { return $default; } $var = $types[$type]; $is_recursive_static = true; } else { $var = $type; } $ret = array(); foreach ((array)$default as $key => $value) { if (!isset($var[$key])) { $ret[$key] = $value; } elseif (is_array($value)) { $ret[$key] = filter_input_utf8($var[$key], $value); } elseif (is_array($var[$key]) || !preg_match('//u', $var)) { $ret[$key] = $value; } else { $ret[$key] = $var[$key]; } } if (!$is_recursive) { $is_recursive_static = false; } return $ret; } $_POST = array( 'a' => array( 'b' => 'Invalid Data', ), 'c' => array( 'd' => 'Valid Data', ), 'e' => 'Valid Data', 'f' => 'Unneeded Data', ); $post = filter_input_utf8($_POST, array( 'a' => null, 'c' => array( 'd' => null, ), 'e' => null, )); var_dump($post);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9g2pR
function name:  (null)
number of ops:  12
compiled vars:  !0 = $post
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   FETCH_W                      global              $1      '_POST'
          1        ASSIGN                                                   $1, <array>
   49     2        INIT_FCALL                                               'filter_input_utf8'
          3        FETCH_R                      global              ~3      '_POST'
          4        SEND_VAL                                                 ~3
   50     5        SEND_VAL                                                 <array>
          6        DO_FCALL                                      0  $4      
   49     7        ASSIGN                                                   !0, $4
   56     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function filter_input_utf8:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 28
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 24
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 68
Branch analysis from position: 32
2 jumps found. (Code = 78) Position 1 = 33, Position 2 = 68
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 40
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 51
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
Branch analysis from position: 51
2 jumps found. (Code = 47) Position 1 = 54, Position 2 = 60
Branch analysis from position: 54
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 64
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 67
Branch analysis from position: 67
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
Branch analysis from position: 60
Branch analysis from position: 68
2 jumps found. (Code = 43) Position 1 = 71, Position 2 = 72
Branch analysis from position: 71
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
Branch analysis from position: 68
Branch analysis from position: 28
2 jumps found. (Code = 77) Position 1 = 32, Position 2 = 68
Branch analysis from position: 32
Branch analysis from position: 68
filename:       /in/9g2pR
function name:  filter_input_utf8
number of ops:  74
compiled vars:  !0 = $type, !1 = $default, !2 = $is_recursive_static, !3 = $is_recursive, !4 = $types, !5 = $var, !6 = $ret, !7 = $value, !8 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
    3     2        BIND_STATIC                                              !2
    4     3        ASSIGN                                                   !3, !2
    5     4        BOOL_NOT                                         ~10     !2
          5      > JMPZ                                                     ~10, ->28
    7     6    >   FETCH_R                      global              ~11     '_GET'
          7        INIT_ARRAY                                       ~12     ~11, 1
    8     8        FETCH_R                      global              ~13     '_POST'
          9        ADD_ARRAY_ELEMENT                                ~12     ~13, 0
    9    10        FETCH_R                      global              ~14     '_COOKIE'
         11        ADD_ARRAY_ELEMENT                                ~12     ~14, 2
   10    12        FETCH_CONSTANT                                   ~15     'INPUT_REQUEST'
         13        FETCH_R                      global              ~16     '_REQUEST'
         14        ADD_ARRAY_ELEMENT                                ~12     ~16, ~15
   11    15        FETCH_R                      global              ~17     '_ENV'
         16        ADD_ARRAY_ELEMENT                                ~12     ~17, 4
   12    17        FETCH_R                      global              ~18     '_SERVER'
         18        ADD_ARRAY_ELEMENT                                ~12     ~18, 5
    6    19        ASSIGN                                                   !4, ~12
   14    20        ISSET_ISEMPTY_DIM_OBJ                         0  ~20     !4, !0
         21        BOOL_NOT                                         ~21     ~20
         22      > JMPZ                                                     ~21, ->24
   15    23    > > RETURN                                                   !1
   17    24    >   FETCH_DIM_R                                      ~22     !4, !0
         25        ASSIGN                                                   !5, ~22
   18    26        ASSIGN                                                   !2, <true>
         27      > JMP                                                      ->29
   20    28    >   ASSIGN                                                   !5, !0
   22    29    >   ASSIGN                                                   !6, <array>
   23    30        CAST                                          7  ~27     !1
         31      > FE_RESET_R                                       $28     ~27, ->68
         32    > > FE_FETCH_R                                       ~29     $28, !7, ->68
         33    >   ASSIGN                                                   !8, ~29
   24    34        ISSET_ISEMPTY_DIM_OBJ                         0  ~31     !5, !8
         35        BOOL_NOT                                         ~32     ~31
         36      > JMPZ                                                     ~32, ->40
   25    37    >   ASSIGN_DIM                                               !6, !8
         38        OP_DATA                                                  !7
         39      > JMP                                                      ->67
   26    40    >   TYPE_CHECK                                  128          !7
         41      > JMPZ                                                     ~34, ->51
   27    42    >   INIT_FCALL_BY_NAME                                       'filter_input_utf8'
         43        CHECK_FUNC_ARG                                           
         44        FETCH_DIM_FUNC_ARG                               $36     !5, !8
         45        SEND_FUNC_ARG                                            $36
         46        SEND_VAR_EX                                              !7
         47        DO_FCALL                                      0  $37     
         48        ASSIGN_DIM                                               !6, !8
         49        OP_DATA                                                  $37
         50      > JMP                                                      ->67
   28    51    >   FETCH_DIM_R                                      ~38     !5, !8
         52        TYPE_CHECK                                  128  ~39     ~38
         53      > JMPNZ_EX                                         ~39     ~39, ->60
         54    >   INIT_FCALL                                               'preg_match'
         55        SEND_VAL                                                 '%2F%2Fu'
         56        SEND_VAR                                                 !5
         57        DO_ICALL                                         $40     
         58        BOOL_NOT                                         ~41     $40
         59        BOOL                                             ~39     ~41
         60    > > JMPZ                                                     ~39, ->64
   29    61    >   ASSIGN_DIM                                               !6, !8
         62        OP_DATA                                                  !7
         63      > JMP                                                      ->67
   31    64    >   FETCH_DIM_R                                      ~44     !5, !8
         65        ASSIGN_DIM                                               !6, !8
         66        OP_DATA                                                  ~44
   23    67    > > JMP                                                      ->32
         68    >   FE_FREE                                                  $28
   34    69        BOOL_NOT                                         ~45     !3
         70      > JMPZ                                                     ~45, ->72
   35    71    >   ASSIGN                                                   !2, <false>
   37    72    > > RETURN                                                   !6
   38    73*     > RETURN                                                   null

End of function filter_input_utf8

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.16 ms | 1407 KiB | 18 Q