FILTER_SANITIZE_NUMBER_FLOAT filter removes all illegal characters in floating point numbers.
This filter allows all numbers as well as + - by default
Name: "number_float"
ID-number: 520
Possible signs:
FILTER_FLAG_ALLOW_FRACTION - allow decimal separators (e.g. .)
FILTER_FLAG_ALLOW_THOUSAND - allow thousands separators (e.g., )
FILTER_FLAG_ALLOW_SCIENTIFIC - allow scientific notation (such as e and E)
<?php$number="5-2f+3.3pp";var_dump(filter_var($number, FILTER_SANITIZE_NUMBER_FLOAT,FILTER_FLAG_ALLOW_FRACTION));?>
The output of the code looks like this:
string(7) "5-2+3.3"