PHP FILTER_SANITIZE_NUMBER_INT Filter
Definition and Usage
The FILTER_SANITIZE_NUMBER_INT filter removes all illegal characters from numbers.
This filter allows all numbers as well as + and -.
- Name: "number_int"
- ID-number: 519
Example
<?php
var_dump(filter_var($number, FILTER_SANITIZE_NUMBER_INT
));
?>
Output:
string(5) "5-2+3"