Jump to content

Recommended Posts

Hello,sry if it is a dumb question,but im trying to write an if construct which usses isset and my problem is that i  want it to execute only if isset is false.

 

My idea looks like this,but when it's executed i get error about unexpected false.So how do i make such construct work only incase $val is false?

if(isset($val)))==false
{
}

Link to comment
https://forums.phpfreaks.com/topic/162266-solved-if-construct-using-isset/
Share on other sites

Hello,sry if it is a dumb question,but im trying to write an if construct which usses isset and my problem is that i  want it to execute only if isset is false.

 

My idea looks like this,but when it's executed i get error about unexpected false.So how do i make such construct work only incase $val is false?

if(isset($val)))==false
{
}

 

It's a syntax error.  You simply need:

if(!isset($val))
{
   /* code */
}

 

The '!' is a logical NOT, so the expression literally says "If $val IS NOT set, execute the following code."

 

EDIT: Remember also that checking to see if a value is set is NOT the same as checking whether it's value is false.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.