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

后端 未结 7 1105
孤独总比滥情好
孤独总比滥情好 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:39

    Yes, == is case sensitive. The easiest way for me is to convert to uppercase and then compare. In instance:

    $var = "Hello";
    if(strtoupper($var) == "HELLO") {
        echo "identical";
    }
    else {
        echo "non identical";
    }
    

    I hope it works!

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