English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

if($WATCH4 !== NULL)
{
echo"Its got something in it";
}
else
{
echo "Its empty";
}

I have this, its ment to say "its empty" because theres definatly nothing in it. However it always says its full. Is there anything wrong with this script or any other method i could use thanks?

2006-12-16 08:00:03 · 1 answers · asked by peter s 1 in Computers & Internet Programming & Design

1 answers

!== checks both the contents and the TYPE of the variable. If $WATCH4 is an empty string, then it has a type of "String", which is different than a type of NULL.

Try the empty function.

if(empty($WATCH4))
{
echo "Its empty";
}
else
{
echo "Its got something in it";
}

2006-12-16 08:13:42 · answer #1 · answered by watsonc64 3 · 0 0

fedest.com, questions and answers