tcpa41 Posted June 15, 2009 Share Posted June 15, 2009 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 More sharing options...
KevinM1 Posted June 15, 2009 Share Posted June 15, 2009 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. Link to comment https://forums.phpfreaks.com/topic/162266-solved-if-construct-using-isset/#findComment-856396 Share on other sites More sharing options...
tcpa41 Posted June 15, 2009 Author Share Posted June 15, 2009 Ty for pointing out Link to comment https://forums.phpfreaks.com/topic/162266-solved-if-construct-using-isset/#findComment-856484 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.