1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Elseif () PHP Function

By

Definition: As it's name implies, elseif () works similar to if () and else () statements. However, using elseif () gives you more than two possible outcomes. Unlike else () which executes in all cases the if () is false... elseif () only executes if the statement is true.
Also Known As: Else If
Examples:
 <?php 
 if ($x > $y) 
 { 
 echo "x is larger than y"; 
 } 
 elseif ($x == $y) 
 { 
 echo "x is equal to y"; 
 } 
 else 
 { 
 echo "x is smaller than y"; 
 } 
 ?> 
Related Video
Basic PHP Syntax
Using PHP With HTML
Top Related Searches
  • lt
    1. About.com
    2. Technology
    3. PHP / MySQL
    4. PHP Functions
    5. PHP Else/If Function Tutorial

    ©2014 About.com. All rights reserved.