hi ,
I have a general question which im not sure of.
when i write this code:

<?php
$abc = true;
if ($ver == $var)
{
$abc = false;
}

if (!$abc)
{
echo "something";
}
else
{
echo "nothing";
}
?>

Now , my problem comes to the statement if (!$abc) :
does this ask : if $abc = false or does it check what $abc currently is (false or true) and requires the opposite?
If my question is anyhow unclear tell me and ill rephrase.
thanks ahead guys .

    if (!$abc)

    asks if $abc = false then do ....

      To better explain it "!" means opposite. So in general if you test for a variable, you say if($var) meaning that if $var equates to true in one of three ways: (1) Is a string (empty or not), (2) is a number not equal to 0, or (3) is the boolean "true". So by saying !$var you're saying If $var != true....

        bpat1434 wrote:

        To better explain it "!" means opposite. So in general if you test for a variable, you say if($var) meaning that if $var equates to true in one of three ways: (1) Is a string (empty or not), (2) is a number not equal to 0, or (3) is the boolean "true". So by saying !$var you're saying If $var != true....

        So making sure i got it right - if i set:
        $var = false;
        if (!$var) would mean:
        if $var != false;
        which would mean:
        if $var = true ;
        correct ? 🙂

          No it mean

          if $var != true;

          or

          if $var = false

            No... $var would still be false, but what would execute is that first if statement. Think of it this way:

            !$var is the same as saying $var == false
            and
            $var is the same as saying $var == true

              Alright got it , thanks guys =]

                Write a Reply...