Book: PHP to TypeScript
Also by me: The TypeScript Library — the 5-book collection
My project: Hermes IDE | GitHub — an IDE for developers who ship with Claude Code and other AI coding tools
Me: xgabriel.com | GitHub
Your PHP controller builds the shipping options for a checkout dropdown. Product wants Express on top, so you build the array in that order: ['10' => 'Express', '2' => 'Standard', 'pickup' => 'Store pickup'] . The JSON leaves the server with the keys in that order. The TypeScript frontend loops over it with Object.entries , and Standard renders first.
Nobody sorted anything. Both runtimes did exactly what their specs say. A PHP array remembers insertion order for every key.…