PHP switch case default

Viewed 45777

Will the default of a switch statement get evaluated if there's a matching case before it?

ex:

switch ($x) {
  case ($x > 5): print "foo";
  case ($x%2 == 0): print "bar";
  default: print "nope";
}

so for x = 50, you'd see foo and bar, or foo and bar and nope?

4 Answers
Related