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

Link to comment
Share on other sites

$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
Share on other sites

$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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.