Closed BenTangible closed 7 months ago
For this, it was indeed sorting the map keys alphabetically. I've removed that default, and added support for optionally sorting keys with sort_field=key
.
However, in PHP and JavaScript, the order of the map keys is not guaranteed by the language specification. In practice they're always in the order that they were defined, but it might change, for example, if a language runtime decides to do some performance optimization.
By the way, the template with emojis was a fun example, I copied it to create tests and it made the work more enjoyable.
It seems that the
map_keys
loop type doesn't default to looping through key/value pairs in the order they're specified, but instead sorts them into alphabetical order by key. Here's a simple example:This outputs: