Are PHP Associative Arrays ordered?

前端 未结 4 1552
走了就别回头了
走了就别回头了 2020-11-30 11:52

I come from python background and the python datatype which is similar (a dictionary) is an unordered set of key value pairs.

I am wondering if PHP

4条回答
  •  臣服心动
    2020-11-30 12:32

    From the php manual:

    Arrays are ordered. The order can be changed using various sorting functions. See the array functions section for more information.

    I have relied on the fact that they are ordered and it has worked consistently in every project I've had.

提交回复
热议问题