php: echo ('x' == 0) prints 1 (true). is this correct?

后端 未结 1 1368
無奈伤痛
無奈伤痛 2021-01-20 08:04

my friend and me found this while debugging an application


<         


        
相关标签:
1条回答
  • 2021-01-20 08:11

    The string is converted to a number using "type juggling". This is shown in the documentation, too.

    For this particular case, the string doesn't start with a number, so it becomes equal to 0 when cast.

    0 讨论(0)
提交回复
热议问题