mikhl Posted November 21, 2011 Share Posted November 21, 2011 Hi people, I recently has a simple if statement like below: if(!is_null($var){ //some code } and it was not working. So I changed it to: if($var != null){ //some code } After that it worked just as expected; am I missing something. I am a little confused. Quote Link to comment https://forums.phpfreaks.com/topic/251513-the-use-of-is_null/ Share on other sites More sharing options...
Pikachu2000 Posted November 21, 2011 Share Posted November 21, 2011 Post the code that isn't producing the results you think it should, tell us what you think the results should be, and include the values of the variables you're using. Quote Link to comment https://forums.phpfreaks.com/topic/251513-the-use-of-is_null/#findComment-1289890 Share on other sites More sharing options...
silkfire Posted November 21, 2011 Share Posted November 21, 2011 if(!is_null($var){ //some code } Is not going to work because you missed a parenthesis. if($var != null){ //some code } Is not working because you have to assert type as well by adding an extra equal sign: !== Quote Link to comment https://forums.phpfreaks.com/topic/251513-the-use-of-is_null/#findComment-1289933 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.