Filter and Sanitize Number Integer Constant in PHP



The FILTER_SANITIZE_NUMBER_INT constant deletes all illegal characters from a number.

Return

The FILTER_SANITIZE_NUMBER_INT constant does not return anything.

Example

 Live Demo

<?php
   $var = "4-5+9p";
   var_dump(filter_var($var, FILTER_SANITIZE_NUMBER_INT));
?>

Output

The following is the output.

string(5) "4-5+9"
Updated on: 2020-06-27T08:46:14+05:30

618 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements