I have an array like this one
$state[1]='FG';
$state[2]='BU';
$state[3]='CA';
...
$state[150]='YT'
What I need is to have the $state array ordered from A to Z and maintain, in some structure, the original order of the array.
Something like:
$state_ordered['BU']=2;
$state_ordered['CA']=3;
and so on.
I have the array in the first form in an include file: which is the most performant way and which is the related structure to use in order to have the best solution?
The include is done at each homepage opening…
Thanks in advance,
A.
Well, you can
array_flipthe array, thus making ‘values’ be the original indexes, and then sort it by keys…then work with
$bkeys , but the values reflect original order