duang8642 2012-12-07 05:26 采纳率: 0%
浏览 57
已采纳

为什么数组=== array在PHP中等于true?

In php === is the identical comparison operator i.e. checks if two variables have equal values and are of the same type. But why array("asdf") === array("asdf") returns true? I guess both of these create new arrays with same contents(please correct me if I am wrong).

  • 写回答

3条回答 默认 最新

  • douzhou7656 2012-12-07 05:28
    关注

    Simple answer: array("asdf") === array("asdf") returns true because the two arrays being compared:

    1. have the same key/value pairs,
    2. each of the same types, and
    3. in the exact same order.

    That's what array() === array() means.

    Good Read

    Array Operators

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?