Are PHP Associative Arrays ordered?

前端 未结 4 1554
走了就别回头了
走了就别回头了 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:40

    The documentation states:

    An array in PHP is actually an ordered map.
    

    So yes, they are always ordered. Arrays are implemented as a hash table.

提交回复
热议问题