Page 1 of 1

[SOLVED]Why wont this if (isset($strlvl)) code work?

Posted: Thu Dec 07, 2006 9:21 pm
by Mythic Fr0st
Well im trying to develop a little stat system thingy, but...

it wont let me use isset to check if it has been set or not

Code: Select all

if (isset($strlvl))
{
echo 'boo';
}
else
{
$strlvl=4;
}
can you see my error? oh, and if you can fix it, how where do I put the ! so its like

if (!isset($strlvl)) so its saying if its false

- Thanks

NVM I cant belive I didnt notice, it was the wrong line lolz

Posted: Thu Dec 07, 2006 9:29 pm
by aaronhall
What is it not doing that it's supposed to do? If the isset is never returning false, it may be that you are evaluating an initialized string (that is storing boolean false, the integer zero, or an empty string), and not an uninitialized variable that represents NULL. isset will only return false if the variable has not yet been initialized, or is equal to NULL. Try using empty if you just want to check if the variable returns false.