Is this php behaviour explained somewhere in manual? (strings with zeroes comparison)

前端 未结 5 1090
后悔当初
后悔当初 2020-12-22 01:03

Why for php

\'00\' == \'0000\'

expression is true?

Is it explained somewhere in manual?

NOTE:

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-22 01:44

    It's also good to remember that

    If you compare a number with a string or the comparison involves numerical strings, then each string is converted to a number and the comparison performed numerically. These rules also apply to the switch statement. The type conversion does not take place when the comparison is === or !== as this involves comparing the type as well as the value. enter link description here

    But everything everyone else has said is correct!

提交回复
热议问题