Re: restating plea for help with sort
| From: | Kevin Stone | Date: | Thu, 27 Feb 2003 19:04:43 +0000 |
| Subject: | Re: restating plea for help with sort | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-137455@lists.php.net to get a copy of this message | ||
Hmm well upon first glance looks like all you need to do is loop that array
and start a new array within the loop. An If/Else construct checks If the
value is "n/a" then append to the back of the new array Else prepend to the
front of the new array. You append the values manually or use
array_push() and array_unshift(). Search the manual for more information.
Hope that helps.
- Kevin
----- Original Message -----
From: "Jim Long" <jim@jimlong.net>
To: <php-general@lists.php.net>
Sent: Thursday, February 27, 2003 11:35 AM
Subject: [PHP] restating plea for help with sort
> Hi,
>
> I have an array with an html link as key and different $vars as val:
>
> $list = array (
> '<a href="http://someplace.com/">some
> place</a>' => $vendor1_total,
> '<a
> href="http://anotherplace.com/">another
> place</a>' => $vendor2__total,
> [snip] etc..
>
> some vals are numeric and some vals are "n/a"
> asort works to sort the array as a string, however, I need to sort the
> numeric vals numeric, then have the n/a's go away or be output at the
> bottom of the sort.
>
> Please be clear and gentle.. I'm not schooled in php, just a tinkerer
> trying to make this mess work.
>
> Thanks In Advance,
>
> Jim Long
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>