I'd do this I think:

uksort($A,'strcasecmp');
reset($A);
while(list($key,$val)=each($A))
{
uksort($A[$key],'strcasecmp');
}

-- 
// DvDmanDT
MSN: dvdmandt€hotmail.com
Mail: dvdmandt€telia.com
"Richard A. Devenezia" <[EMAIL PROTECTED]> skrev i meddelandet
news:[EMAIL PROTECTED]
> I have this little code.
> I want all arrays sorted case insensitive key order, but only the first
> dimension gets key sorted properly
>
> Thanks
> -- 
> Richard A. DeVenezia
>
> <?
>
> $A = array (
>   "C" => array ( "x" => 1, "Z" => 2, "y" => 3)
> , "b" => array ( "z" => 1, "Y" => 2, "x" => 3)
> , "A" => array ( "z" => 1, "X" => 2)
> );
> print_r ($A);
>
> // sort dim1
> uksort ($A, "strcasecmp");
> print_r ($A);
>
> // sort each dim2
> while (list($key,$dim2) = each ($A)) {
>   uksort ($dim2, "strcasecmp");
> }
> print_r ($A);
>
> ?>
>
> It comes out
>
> Array
> (
>     [A] => Array
>         (
>             [z] => 1
>             [X] => 2
>         )
>
>     [b] => Array
>         (
>             [z] => 1
>             [Y] => 2
>             [x] => 3
>         )
>
>     [C] => Array
>         (
>             [x] => 1
>             [Z] => 2
>             [y] => 3
>         )
> )
>
> I want
>
> Array
> (
>     [A] => Array
>         (
>             [X] => 2
>             [z] => 1
>         )
>
>     [b] => Array
>         (
>             [x] => 3
>             [Y] => 2
>             [z] => 1
>         )
>
>     [C] => Array
>         (
>             [x] => 1
>             [y] => 3
>             [Z] => 2
>         )
> )

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to