Why execute statements after unsatisfied case conditions after omitting break in switch statements? Isn’t the execution based on comparison of case conditions?

  question
$a=5;
 switch($a){
 case 6:
 echo "\$a is 6<br/>";
 case 5:
 echo "\$a is 5<br/>";
 case 4:
 echo "\$a is 4<br/>";
 bracket

In the above example, my understanding is that every time $a is compared with the value after case, the statement will be output if it meets the requirement, and the next case condition will be compared if it does not meet the requirement. But the output of the browser is
$a is 5
$a is 4
I don’t quite understand the last case statement clearly $a! =4 will also be output.
(My previous understanding that the switch statement must break broken was that it can jump out of the switch as soon as a case that meets the criteria is found, thus speeding up the execution. Now it seems not. )

As you can understand, switch will jump to the first matching case to continue execution according to the conditions.
Case is only a flag for switch to jump, and has no function of dividing blocks.

So:

  • Even if there are multiple cases matching switch, it will only jump to the first matching case.
  • If it does not break, it will start with the first case matching and continue until the end of the entire switch structure.