I follow some data verification exercises and decided to team up with the function filter_input(). When I try to run this code:
$_POST['var'] = 10;
$filtered = filter_input(INPUT_POST, 'var', FILTER_VALIDATE_FLOAT);
var_dump($filtered);
var_dump($filtered)returns null. I know that code works if $_POST['var']a value is assigned by submitting a form, but I'm just wondering why manually assigning a value to an array $_POST[]does not return float(10)?
source
share