PHP
Conditionals IF THEN and SWITCH CASE
If then conditional, switch case conditional, examples
Conditional Code Example
IF THEN and SWITCH CASE conditional
<?php // Code that applies for a specific date $current_day = date("l"); echo "Today is :". $current_day. "<br/>"; echo "<br/>If condition using IF <br/><br/>"; if ($current_day == "Saturday" || $current_day == "Sunday") { echo "Let's go to the beach! "; } elseif ($current_day == "Friday" ) { echo "Weekend is almost here! "; } else { echo "You better get back to work!"; } echo "<br/><br/>If condition using SWITCH CASE<br/><br/>"; switch ($current_day) { case "Friday": echo "Weekend is almost here! "; break; case "Saturday": case "Sunday": echo "Let's go to the beach!"; break; default: echo "You better get back to work! "; }