All PHP arrays, numerical and associative, are implemented as a so-called "ordered hash table". This is a data science term that means: "A smart, fast storage of key values ββthat keeps track of the order in which keys and values ββwere inserted." In other words, PHP arrays have a bit of memory to remember order. Every time you put something into it, PHP automatically brings order there.
Interestingly, this happens for numeric keys as well-, so if you put the values ββ1,2,3,4,5 in a PHP array, PHP will still keep order separately. If this sounds wasteful, then because it is! This, however, preserves brain cycles that can be used to solve other problems of people, real and imaginary.
cmc
source share