I had a similar problem:
I am using several values, joined with hyphens, to serve as a key, which I later split into the three separate values. I too was getting the keys coming out in the unnatural order.
I solved the problem like this:
If any of the individual numbers is less than 10, I add a '0' to the number on INSERT. (eg. assignmentKey = '01-02-10'). When the keys are listed, they list in the proper order.
Then when I split the values back out, I usePHP's settype() function to convert the numerical strings to their integer values, thus dropping the '0's.
list($dbLangNum,$dbModNum,$dbActNum) = split ("-", $activityKey);
settype($dbLangNum, "integer");
settype($dbModNum, "integer");
settype($dbActNum, "integer");
So, what I get for each is:
$dbLangNum = 1;
$dbModNum = 2;
$dbActNum = 10;
A bit of extra overhead, but it works nicely.
Good luck.
Ken