In PHP, there are a range of built-in functions which you can call to check variable types. They return a Boolean value – true if the variable is of that type and false if it is not.
To check if a variable contains a string, you can use the is_string function. You can use it like that:
echo var_dump(is_string("DQDQ")); // true echo var_dump(is_string(23)); // false echo var_dump(is_string("11")); // true
You should be aware that a number within a string (for example, coming from user input) is still a string and not a number when checking the variable type.
To check whether a variable is an integer, you can use the is_int function.