If and Else

Discussion in 'PHP' started by demons-halo, Sep 24, 2009.

  1. #1
    How would i make an if statement so if variable 1 is the same as variable 2 it displays the word "same" and if they are different it displayes the word "different"


    thanks

    dH
     
    demons-halo, Sep 24, 2009 IP
  2. Spawny

    Spawny Well-Known Member

    Messages:
    252
    Likes Received:
    23
    Best Answers:
    0
    Trophy Points:
    110
    #2
    try this
    
    <?php
    if($var1 == $var2)
    {
         echo 'same';
    }
    else
    {
        echo 'different';
    }
    ?>
    
    PHP:
     
    Spawny, Sep 24, 2009 IP
  3. demons-halo

    demons-halo Active Member

    Messages:
    243
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    55
    #3
    thank you very much :D
     
    demons-halo, Sep 24, 2009 IP