How does PHP compare strings with comparison operators?

前端 未结 4 1773
清歌不尽
清歌不尽 2020-12-02 00:14

I\'m comparing strings with comparison operators.

I needs some short of explanations for the below two comparisons and their result.

if(\'ai\' >          


        
4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-02 00:31

    To expand on @coderabbi's answer:

    It is the same type of logic as when you order by number in some applications and get results like the following:

    • 0
    • 1
    • 105
    • 11
    • 2
    • 21
    • 3
    • 333
    • 34

    It's not based on string length, but rather each character in order of the string.

提交回复
热议问题