shane18 Posted September 20, 2009 Share Posted September 20, 2009 when you do if($BLAH = $BLAH2) ... that makes $BLAH value = $BLAH2.... and if that makes $BLAH higher than 0(aka makes it true)... it makes the if statement true? i been coding with unanwsered questions.. and now i been on here helpin with easy stuff and asking questions to improve my knowledge more Link to comment https://forums.phpfreaks.com/topic/174865-solved-another-noob-question/ Share on other sites More sharing options...
5kyy8lu3 Posted September 20, 2009 Share Posted September 20, 2009 when you do if($BLAH = $BLAH2) ... that makes $BLAH value = $BLAH2.... and if that makes $BLAH higher than 0(aka makes it true)... it makes the if statement true? i been coding with unanwsered questions.. and now i been on here helpin with easy stuff and asking questions to perfect my knowledge more yea if you use a single equals sign it equates to true, but I'm not sure if that's what you're asking Link to comment https://forums.phpfreaks.com/topic/174865-solved-another-noob-question/#findComment-921543 Share on other sites More sharing options...
shane18 Posted September 20, 2009 Author Share Posted September 20, 2009 if $BLAH = NULL, and $BLAH2 = 6... if you do if($BLAH = $BLAH2) that will be true because $BLAH now has the value of 6.. which makes the statement true right? Link to comment https://forums.phpfreaks.com/topic/174865-solved-another-noob-question/#findComment-921544 Share on other sites More sharing options...
corbin Posted September 20, 2009 Share Posted September 20, 2009 $a = $b will return what ever the value of $b is: $b = true; if($a = $b) //true $b = 1; if($a = $b) //true $b = '1'; if($a = $b) //true $b = false; if($a = $b) //false You get the point. Link to comment https://forums.phpfreaks.com/topic/174865-solved-another-noob-question/#findComment-921546 Share on other sites More sharing options...
shane18 Posted September 20, 2009 Author Share Posted September 20, 2009 $a = $b will return what ever the value of $b is: $b = true; if($a = $b) //true $b = 1; if($a = $b) //true $b = '1'; if($a = $b) //true $b = false; if($a = $b) //false You get the point. then from that point forward... $BLAH = 0; $BLAH2 = 6; if($BLAH = $BLAH2)//Equals TURE and then echo $BLAH would display 6 right? Link to comment https://forums.phpfreaks.com/topic/174865-solved-another-noob-question/#findComment-921548 Share on other sites More sharing options...
5kyy8lu3 Posted September 20, 2009 Share Posted September 20, 2009 $a = $b will return what ever the value of $b is: $b = true; if($a = $b) //true $b = 1; if($a = $b) //true $b = '1'; if($a = $b) //true $b = false; if($a = $b) //false You get the point. then from that point forward... $BLAH = 0; $BLAH2 = 6; if($BLAH = $BLAH2)//Equals TURE and then echo $BLAH would display 6 right? you're basically saving the contents of $blah2 into $blah, then using $blah to test for true/false. so basically, as long as $blah2 doesn't contain 0, null, or false, it should be true. Link to comment https://forums.phpfreaks.com/topic/174865-solved-another-noob-question/#findComment-921565 Share on other sites More sharing options...
shane18 Posted September 20, 2009 Author Share Posted September 20, 2009 thanks man for clearing that up Link to comment https://forums.phpfreaks.com/topic/174865-solved-another-noob-question/#findComment-921567 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.