tomd79 Posted July 1, 2008 Share Posted July 1, 2008 in my code I have a simple if else.. if (a==NULL) { die "bad robot"; { else blah blah blah I want to be able to test 2 conditions in the if i.e. if (a==NULL & b==SomeValue) { die "bad robot"; { else blah blah blah been searching and come up blank.. anyone show me how? Quote Link to comment https://forums.phpfreaks.com/topic/112746-solved-quick-syntax-question/ Share on other sites More sharing options...
trq Posted July 1, 2008 Share Posted July 1, 2008 Close but no cigar. if ($a == NULL && $b == 'SomeValue') { Quote Link to comment https://forums.phpfreaks.com/topic/112746-solved-quick-syntax-question/#findComment-579048 Share on other sites More sharing options...
tomd79 Posted July 1, 2008 Author Share Posted July 1, 2008 ta... where the condition is the same for 2.. can I use one test.. (this failed when tested) like if ($a && $b == NULL); {} Quote Link to comment https://forums.phpfreaks.com/topic/112746-solved-quick-syntax-question/#findComment-579050 Share on other sites More sharing options...
tomd79 Posted July 1, 2008 Author Share Posted July 1, 2008 works.. Quote Link to comment https://forums.phpfreaks.com/topic/112746-solved-quick-syntax-question/#findComment-579054 Share on other sites More sharing options...
trq Posted July 1, 2008 Share Posted July 1, 2008 ta... where the condition is the same for 2.. can I use one test.. (this failed when tested) like if ($a && $b == NULL); {} No. Quote Link to comment https://forums.phpfreaks.com/topic/112746-solved-quick-syntax-question/#findComment-579152 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.