Foser Posted July 6, 2007 Share Posted July 6, 2007 If I have something like this <?php $num1 = 5 $num2 = 7 if ($num1 = 5){echo $num5;} if ($num2 = 7){echo $num2;} ?> here bot values are true will both of them execute? Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted July 6, 2007 Share Posted July 6, 2007 Yes, they would both execute, but your didn't use the correct operator. <?php $num1 = 5; $num2 = 7; if ($num1 == 5){echo $num5;} if ($num2 == 7){echo $num2;} ?> Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 6, 2007 Share Posted July 6, 2007 if ($num1 = 5){echo $num5;} if ($num2 = 7){echo $num2;} true because the condition is not equalization but the condition try to say that is $num1 successfully set the value the answer is yes so its true Quote Link to comment 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.