What is the difference between Switch and IF?

前端 未结 5 543
终归单人心
终归单人心 2021-01-13 10:30

I know this may be simple question but want to know every ones opinion on this.

what is the difference between switch and IF function in PHP?? What I can see is wher

5条回答
  •  一生所求
    2021-01-13 10:56

    Don't forget, though, that a switch does not necessarily work as a simple if statement. Remembering that a switch does not require a break at the end of each case and leaving that break off allows you to 'fall through' to the next case, too, can allow some interesting and somewhat complex 'ifs'.

提交回复
热议问题