Friday, November 11, 2022

Using Switch Statement in PHP

How to Switch Statement in PHP





The switch statement is used to perform different actions based on different conditions.

$color = "red";
switch ($color) {
case 'red':
echo "This is red color";
break;
case 'white':
echo "This is white color";
break;
case 'pink':
echo "This is Pink Color";
break;
default:
echo "Condition not Matched";
break;
}

0 comments

Post a Comment