This tutorial will help you to understand Input Validation with PHP. (PHP 4, PHP 5, PHP 7) is_string — Détermine si une ... is_string() returns false on an object that has a __toString() method. Possible options and flags: min_range - specifies the minimum integer value; max_range - specifies the maximum integer value; FILTER_FLAG_ALLOW_OCTAL - allows octal number values The awesome language, PHP has numerous in-built functions to validate user inputs. // if it's not a string, nor an integer, we freak out and say no. Here is a simple way to do a check that will work: