Re: [4.3.4] Can't ksort a subarray
| From: | Richard A. DeVenezia | Date: | Thu, 25 Mar 2004 19:06:43 +0000 |
| Subject: | Re: [4.3.4] Can't ksort a subarray | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-181504@lists.php.net to get a copy of this message | ||
Red Wingate wrote:
> while (list($key,$dim2) = each ($A)) {
> uksort ( $A[ $key ] , "strcasecmp");
> }
> print_r ($A);
>
> $dim2 will not change $A[ $key ], so you will have to change your
> script to alter them directly.
>
> -- red
>
Like thus:
uksort ($myArray, "strcasecmp");
foreach (array_keys($myArray) as $key) {
$dim = & $myArray[$key];
uksort ($dim, "strcasecmp");
}
address operator is hard to come by in the docs I have (PHP.chm)
--
Richard