In PHP given a month string such as “November” how can I return 11 without using a 12 part switch statement?

前端 未结 6 1055
攒了一身酷
攒了一身酷 2020-12-06 12:20

I.e.

Month        Returns
January      1
February     2
March        3
April        4
May          5
June         6
July         7
August       8
September           


        
6条回答
  •  囚心锁ツ
    2020-12-06 13:10

    The only thing I can think of off the top of my head is to set each string as a variable and make it = the respective number. But then again I'm pretty new, so I'm eager to see as well if there are any easier ways (=

提交回复
热议问题