else if statements in PHP is like another if condition, it's used in the program when if statement having multiple decisions.



Figure - Flowchart of else if Statement:

php-elseif

Example of a PHP Program to Demonstrate else if Statement

Example:

<?php 
$date=date("m-d"); 

if ($date=="01-10") { 
  echo "Wishing you a very Happy Birthday"; 
}
elseif($date=="08-15"){
  echo "Happy Independence Day"; 
}
else{
  //nothing
}
?>


Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram