Razor42 Posted August 7, 2013 Posted August 7, 2013 Hi guys, I am working on something and I need to so that if three things are correct then the code runs. I have this: if($codeone == $fcr['codeone'] && $codetwo == $fcr['codetwo'] && $codethree == $fcr['codethree']) But this doesn't seem to work. Anyone care to shed some light on my issues? :) Quote
Seker Posted August 7, 2013 Posted August 7, 2013 if(($codeone == $fcr['codeone']) && ($codetwo == $fcr['codetwo']) && ($codethree == $fcr['codethree'])) Have to wrap each individual condition. Quote
HauntedDawg Posted August 8, 2013 Posted August 8, 2013 if(($codeone == $fcr['codeone']) && ($codetwo == $fcr['codetwo']) && ($codethree == $fcr['codethree'])) Have to wrap each individual condition. Not always true. <?php $testone = '5'; $testtwo = 'six'; $testthree = 'l'; if($testone == 5 && $testtwo == 'six' && $testthree == 'l') { echo 'true'; } else { echo 'false'; } ?> echoes out true, so does this: <?php $testone = '5'; $testtwo = 'six'; $testthree = 'l'; if(($testone == 5 || $testtwo == 'si') && $testthree == 'l') { echo 'true'; } else { echo 'false'; } ?> It all depends what you are actually trying to verify. Quote
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.