I have several foreach loops to show all players in a game. There are 10 players in the table, with an id column of type int, auto-incremented. The code looks like this:
foreach(Player::all() as $player) {
echo $player->id;
}
On my dev Mac, MySQL 5.1.70, I get: 1 2 3... On my prod server, MySQL 5.5.31, I get: 1 10 2 3 4 ....
This is consistent in every other place in my code. Now, I get that this is an alphanumeric sort. The question is: why? What can I turn on on the server to get it to match my dev machine, without performing broad code changes?
I'm using PHP 5.4, Apache 2.4, Laravel 4.0.5 with Eloquent
Update:
I found another symptom to this, which might actually be the root cause of the problem: upon analyzing client-side AJAX calls to the server, I found that values return as ints from the dev server, but as strings from the prod server - causing tons of misbehaviors. This explains why I get an ASCII sort. But agai, the question is: what do I need to "fix" on the prod server for this to work?