mercredi 17 juin 2015

if statement vs. switch statement

I know this topic has been talked about before here, but this case was not mentioned, and I'm still not positive which is better.

If you have an if statement that is something like:

if (($var='A') || ($var='B') || ($var='C') || ($var='D')...) { echo "hello world"; }

In this situation, would it be better to use a switch statement?

Thanks!

Aucun commentaire:

Enregistrer un commentaire