How to use FILTER SANITIZE NUMBER INT in PHP

This article describe about FILTER_SANITIZE_NUMBER_INT Filter in PHP.
  • 5300

FILTER_SANITIZE_NUMBER_INT Filter

For remove all illegal characters from a number used FILTER_SANITIZE_NUMBER_INT.

This filter allows digits and . + -

  • Name: "number_int"
  • ID-number: 519

Example

<html>
<body>
<?php
$number="9-3+2abcfghe";
var_dump(filter_var($number, FILTER_SANITIZE_NUMBER_INT));
?>
</body>
</html>

Output

filtersanitizenumberintphp.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.