demo7up Posted September 7, 2012 Share Posted September 7, 2012 I need help making something like this. so for example if ($number == NULL) { echo 'there is a $number'; } else { echo 'There is no value'; } thanks in advance Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 7, 2012 Share Posted September 7, 2012 And the problem is??? Besides the fact that you have a variable inside single quotes? Quote Link to comment Share on other sites More sharing options...
demo7up Posted September 7, 2012 Author Share Posted September 7, 2012 i totally just came up with that in my head had no idea it was correct.. besides the single quotes.. also would this be better? if (isset($number)) { echo "Variable is set"; } else { echo "its not set"; } Quote Link to comment Share on other sites More sharing options...
Jessica Posted September 7, 2012 Share Posted September 7, 2012 I usually use isset personally, I don't know that one version is better than the other. If you "come up" with code, rather than asking other people if it's usable you could, you know, try to use it? Quote Link to comment Share on other sites More sharing options...
spiderwell Posted September 7, 2012 Share Posted September 7, 2012 isset() is to check if the variable has been set, regardless of its value, the first post will tell you if the variable has a value of null. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.