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

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

Why for php

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

expression is true?

Is it explained somewhere in manual?

NOTE:

5条回答
  •  暖寄归人
    2020-12-22 02:08

    Sure

    == compares values and neglects type
    === compares values and types
    

    here is it:

    http://php.net/manual/en/language.operators.comparison.php

    *UPDATE:

    Read this part in this URL :

    http://php.net/manual/en/function.intval.php

    Strings will most likely return 0 although this depends on the leftmost characters of the string. The common rules of integer casting apply.

提交回复
热议问题