Have you considered array_search(array_keys($array),$key)? (Of course, if the array is sorted, the keys aren't in the same place any more.)
Okay, I still don't understand what you're actually trying to do, but it sounds like you need to come up with something a bit smarter than a flat associative array. A multidimensional array, perhaps, that can be indexed numerically:
array(
array('foo','bar'),
array('key','value'),
array('this','that')
);
Sorting such a thing by either the first element or the second is not difficult. If you want, you can make that a value in some associative array, which has key/value pairs for other relevant pieces of information.
Generally speaking, it's better to sit down first and figure out what shape your data should have based on what you're going to be doing with it, and then implement that structure than use the barest simplest structure you can think of and then constantly writing all sorts of scary code to make it behave like something it's not.