Switch PHP | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Switch PHP

Why this: $char a = 'a'; switch ($char) { case 'a': echo 'b', case 'b': echo 'a' } will output 'ba' can someone explain it to me? switch is returning echo or what

24th Apr 2020, 7:21 PM
Jakub Korytko
Jakub Korytko - avatar
2 Answers
+ 1
You used a comma ',' instead of semi-colon ';' after the first echo statement
24th Apr 2020, 7:27 PM
Ore
Ore - avatar
+ 1
ah thanks
24th Apr 2020, 8:11 PM
Jakub Korytko
Jakub Korytko - avatar