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
The array is ordered but that does not mean the keys are sorted, it means that they are in a given order. Where the precise order is not specified, but it appears to be the order in wich you introduced the key-value pairs in it.
To understand it, think what would it mean to not be ordered? Well think to a relation in a relational database. A relation is not intrinsically ordered: when you access it with a query the database, unless you provide an order clause, can return the same data in any order. Even if the data was not modified the same data can be returned in different order.