Php helps you to quickly build big applications and many times, its easy to neglect the security matter. Its easy to believe that security breaches could not happen to your software. But what if it does happen? For this reason, security in your applications should be kept in consideration from the beginning.
The somevar variable is a string. Please note the importance of quotes.
You can check whatever is a string or an integer using is_integer(value) function that returns true if value is an integer. For example:
If (!is_integer($somevar)){ echo (" Hacking Attempt "); exit; }
It is quite common to assign small integer values to your variables in a form. In this case, it is useful to check if your variable is an integer or a string. However, please notice that all variables sent using GET method are strings unlike variables sent using POST method that can be either strings or integers.