PHP FILTER_SANITIZE_NUMBER_FLOAT Filter
Complete PHP Filter Reference Manual
Definition and Usage
The FILTER_SANITIZE_NUMBER_FLOAT filter removes all illegal characters from a float number.
By default this filter allows all digits as well as + -
- Name: "number_float"
- ID-number: 520
Possible flags:
- FILTER_FLAG_ALLOW_FRACTION - Allows a decimal separator (such as .)
- FILTER_FLAG_ALLOW_THOUSAND - Allows a thousand separator (such as ,)
- FILTER_FLAG_ALLOW_SCIENTIFIC - Allows scientific notation (such as e and E)
Example
The output of the code is shown below:
string(7) "5-2+3.3"
Complete PHP Filter Reference Manual