PHP / MySQL

  1. Home
  2. Computing & Technology
  3. PHP / MySQL

Elseif () PHP Function

By Angela Bradley, About.com

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";
}
?>

Explore PHP / MySQL

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

PHP / MySQL

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. PHP Elseif Function - PHP Else If Function - PHP Elseif Tutorial

©2009 About.com, a part of The New York Times Company.

All rights reserved.