Use if-elseif-else statement in PHP
Description
The following code shows how to use if-elseif-else statement.
Example
<?php/* w w w. j a v a 2 s . c o m*/
$name = "Jack";
if($name == "")
{
print("You have no name.");
}
elseif(($name == "leon") OR ($name == "Leon"))
{
print("Hello, Leon!");
}
else
{
print("Your name is '$name'.");
}
?>
The code above generates the following result.