How to add comparaison operators in switch? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to add comparaison operators in switch?

By comparaison operators I mean this: http://php.net/manual/en/language.operators.comparison.php I made a code: https://code.sololearn.com/wQRRXc0f1ePL/# but instead of adding the same echo for multiple cases, instead add something like <= 5 gives the same output. You understand? I tried writing <= 5 directly but the server gave me this error: ( ! ) Parse error: syntax error, unexpected '<=' (T_IS_SMALLER_OR_EQUAL) in C:\wamp64\www\tests\new_2.php on line 8 thanks in advance :D

14th Jul 2017, 3:49 PM
mexikodro thanksgiving samples 1/1
mexikodro thanksgiving samples 1/1 - avatar
3 Answers
14th Jul 2017, 4:05 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 2
@Sami Khan: Thankssss! 🤗 instead of writing ($note<=5) I was writing case <= 5! perfect
14th Jul 2017, 4:09 PM
mexikodro thanksgiving samples 1/1
mexikodro thanksgiving samples 1/1 - avatar
+ 1
it's very logic try it yourself once if not tell me.
25th Jul 2017, 6:04 AM
Roshan Singha
Roshan Singha - avatar