Display the drop-down list

Test of filter_input()

Example #1 : test success
Example #2 : test success
Example #3 : test success
Example #4 : test success
Example #1
$input = [
  
'predefined_var' => '$_GET',
  
'data' => [
    
'search' => 'libgd<script>',
  ],
  
=> 'INPUT_GET',
  
=> 'search',
  
=> 'FILTER_SANITIZE_SPECIAL_CHARS',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 'libgd&#60;script&#62;',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #2
$input = [
  
'predefined_var' => '$_GET',
  
'data' => [
    
'search' => 'libgd<script>',
  ],
  
=> 'INPUT_GET',
  
=> 'search',
  
=> 'FILTER_SANITIZE_ENCODED',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 'libgd%3Cscript%3E',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #3
$input = [
  
'predefined_var' => '$_POST',
  
'data' => [
    
'number' => 3,
  ],
  
=> 'INPUT_POST',
  
=> 'number',
  
=> 'FILTER_CALLBACK',
  
=> [
    
'options' => 'cube',
  ],
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 27,
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #4
$input = [
  
'predefined_var' => 'xyz',
  
'data' => [
    
'number' => 3,
  ],
  
=> 'INPUT_POST',
  
=> 'number',
  
=> 'FILTER_CALLBACK',
  
=> [
    
'options' => 'cube',
  ],
]
$expected_output = $test_output
$test_output = [
  
'errors' => [
    
=> [
      
'code' => 256,
      
'message' => 'this variable name is invalid (xyz)',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]