Results 1 to 1 of 1

Thread: If and Else

  1. #1
    hirudora
    hirudora is offline
    Guest
    Join Date
    2012 Sep
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Rep Power
    0

    If and Else

    We will not treat to IF and Else

    IF

    IF, serves to create names veriaveis when they may or may not be altered, as it is an "if" in the same page.
    It's like she check whether YES or NO.

    Example:

    PHP Code:
    <?php 

    $number1 
    6// will be the first number in our first variable
    $number2 12// will be our second variable.

    if ($number1 $number2){ // if 6 is less than 12

                
    echo "True"//  if true alternative to the above, it shows a message like that.



    ?>
    ELSE

    The ELSE, always acts after the "if" he is how one if not.

    Example:

    PHP Code:
    <?php 

    $number1 
    6// will be the first number in our first variable
    $number2 12// will be our second variable. 

    if ($number1 $number2){ // if 6 is less than 12

                
    echo "True"// if true alternative to the above, it shows a message like that.

    }else{

              echo 
    "False"// if false alternative to the above, it shows a message like that.

    ?>
    If $number 1 is less than $number 2 shows "TRUE"
    If not, shows "FALSE".

    Simple, no? Good. tomorrow I'll pass on "For" and "Variable and Echo"

    Goodnight and good studies!

Visitors found this page by searching for:
Nobody landed on this page from a search engine, yet!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •