Jump to content

[SOLVED] Another noob question :)


shane18

Recommended Posts

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

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

$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?

$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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.