[EMAIL PROTECTED] wrote:
> ----- Original Message -----
> From: "Wade Smart"
>
> I have a nested array.
>
> [0]
> ( [0] = 4 [1] = value1)
> [1]
> ( [0] = 2 [1] = value2)
>
>
> There are a about a hundred or so everything this runs.
>
> The first value (4 or 2) are value indicators for the value (value1 or
> value2). Like a ranking of sorts.
>
> These values are ranked in groups from 1 to 20. There could be 30 items
> that fall in the ranking of 15 category. There might be only five items
> ranked as a 5.
>
> So what I want to do is sort these according to rank. So I want all the
> ones at the top and 20's at the bottom. Im not sure how to do this :)
>
> Im looking through the php functions for arrays but Im not sure how to
> sort based on the first value of a nested array.
>
> Wade
>
> ------------------------------------
>
> Hi Wade,
>
> I can't see an easy way to do it with php array functions. It looks like you
> have to flatten the array.
>
> foreach($array as $this_array)
> {
> foreach($this_array as $key => $value)
> {
> $new_array[$value] = $key;
> }
> }
> $result = arsort($new_array, SORT_NUMERIC);
>
> It should also be easier in php v 5.x.x because you can move keys and values
> as sets.
2081010 1926 GMT-6
Yea, that was where I was going too. I finally pulled the array apart
and did it a LONG way and it worked but -- it was an extra step that I
didnt want but --- it worked.
Wade