Only numbers like: 123, 012 (12), positive numbers should be valid. 1- +111+ 5xf 0xf Those kind of numbers should not be valid. The FILTER_VALIDATE_INT filter is used to validate value as integer. REGEXP will interpret the string as a valid number when in fact it is not. (PHP 4, PHP 5, PHP 7) is_string — Détermine si une ... is_string() returns false on an object that has a __toString() method. For eaxmple if your visitors fill out a form with the age field which should be an int. Here is a simple way to do a check that will work: