PHP Conditional Statements

  • Post author:
  • Post category:Beginner Tutorials / PHP
  • Post last modified:July 7, 2021
  • Reading time:1 mins read

In this example, we will discuss php conditional statements. PHP supports the following conditional statements.

  • if conditional statement
  • if…..else conditional statement
  • if….elseif…..else conditional statement
  • switch…..case conditional statement

The if Statement

This is used to executed a block of code when the if condition is true.

if(condition){
    // Code to be executed
}

Example:

<?php 
    $d = date("D"); 
    if($d == "Fri"){     
    echo "Have a nice weekend!"; 
   } 
?>

Updated soon…