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? Link to comment https://forums.phpfreaks.com/topic/58644-solved-quick-if-statement-question/ 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;} ?> Link to comment https://forums.phpfreaks.com/topic/58644-solved-quick-if-statement-question/#findComment-290948 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 Link to comment https://forums.phpfreaks.com/topic/58644-solved-quick-if-statement-question/#findComment-290964 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.