Is == in PHP a case-sensitive string comparison?

后端 未结 7 1108
孤独总比滥情好
孤独总比滥情好 2020-12-13 11:56

I was unable to find this on php.net. Is the double equal sign (==) case sensitive when used to compare strings in PHP?

7条回答
  •  感情败类
    2020-12-13 12:15

    == is case-sensitive, yes.

    To compare strings insensitively, you can use either strtolower($x) == strtolower($y) or strcasecmp($x, $y) == 0

    • strtolower()
    • strcasecmp()

提交回复
热议问题