How is an if statement in the form of [if (($a=$b)===$c)] evaluated

Discussion in 'PHP' started by fireworld2406, Jun 13, 2009.

  1. #1
    Hi!

    I'm just making sure that I'm understanding something correctly.

    Suppose I have the following PHP script:
    
    <?php
    $a="hi";
    $b="bye";
    $c="bye";
    echo ("Before: $a");
    if (($a=$b)===$c) {
    echo ("In: ");
    echo ($a);
    }
    echo ("Out: $a");
    ?>
    
    PHP:
    The if statement sets $a equal to $b and compares it to $c. $a remains the value of $b even after the if statement. I ran the script and that is what it seems to indicate, but I just want to make sure that that is correct and not some fluke.

    Thank you in advance for your help!

    Please let me know if you need any more information!
     
    fireworld2406, Jun 13, 2009 IP
  2. ishanjain2

    ishanjain2 Well-Known Member

    Messages:
    244
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #2
    I didnt get you what are you trying to say.... You know the code and its working then whats the point...

    Here's the output according to me...

    Before: hiIn: byeOut: bye
     
    ishanjain2, Jun 13, 2009 IP