How can I make “GET” understand the number 0 without it understanding that 0 is nothing?
if(empty($_GET['number'])) {
echo "No GET variables";
}
if($_GET['number']){
$number=strip_tags(addslashes(htmlspecialchars($_GET['number'])));
echo $number;
}
If the variable “number” = 1 it will echo “1” but if the number is 0 it will echo “No GET variables”
How can I make it understand 0 as well as other numbers?
emptyreturnstrueif you give it a0; you can useissetinstead to check whether it is set (regardless of value):from http://php.net/empty:
My test:
Your code should look like:
Or more concise