0
Hi my friends . In this sample $x=1 and should run case 1 echo one . But run all of case . Why print all of cases ?
4 Answers
+ 2
Add break statements to the end of each case
+ 2
you are most likely missing a break statement
+ 1
code is :
$x=1;
switch ($x) {
case 1:
echo "One";
case 2:
echo "Two";
case 3:
echo "Three";
default:
echo "No match";
}
0
Can you provide code?