PHP case Keyword

PHP break Keyword
PHP as Keyword

In this article, you will learn how to use case keyword in PHP. The case keyword in PHP is used to jump to a line of code when an expression has a specific value in a switch conditional.

examples of the CASE keyword

Example 1. In this example, we use case to run some code when a variable has a specified value.

$a = 3;
switch($a) {
  case 1:
    echo "One";
  case 2:
    echo "Two";
  case 3:
    echo "Three";
PHP break Keyword
PHP as Keyword
en English
Scroll to Top