On Tuesday 30 April 2002 01:19, Jim Long wrote:
> I have a basic sort:
>
>  $orderd_list = array ("$onec_rounded_total", "$aps_rounded_total",
> "$bo_rounded_total", "$cap3_rounded_total", "$cap3_rounded_total",
> "$cap_rounded_total", "$cfl_rounded_total", "$ecg_rounded_total",
> "$ldd_rounded_total", "$png_rounded_total", "$spr_rounded_total",
> "$ist917_rounded_total", "$tciac_rounded_total", "$tcicl_rounded_total",
> "$utl_rounded_total"); sort ($orderd_list);
>  reset ($orderd_list);
>  while (list ($key, $val) = each ($orderd_list)) {
>  echo "[".$key."] = ".$val."<br>\n";
>
> It returns
>
> [0] = 4.90
> [1] = 4.99
> [2] = 5.06
> [3] = 5.60
> [4] = 6.00
> [5] = 6.00
> [6] = 6.90
> [7] = 6.90
> [8] = 6.95
> [9] = 7.00
> [10] = 9.00
> [11] = 10.50
> [12] = 11.00
> [13] = 11.26
> [14] = 13.10
>
> How do I maintain a varible name (for identification) in this output
> list ie:
>
> onec = 4.90 //from the varible $onec_rounded_total
> cfl = 4.99
> bo = 5.06
> and so on...

First you need to define your array so that it encapsulates some form of 
identification:

  $orderd_list = array ('onec_rounded_total' => $onec_rounded_total,          
                        'aps_rounded_total'  => $aps_rounded_total, ...);

Then use asort().

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Welcome to Lake Wobegon, where all the men are strong, the women are pretty,
and the children are above-average.
                -- Garrison Keillor
*/

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

Reply via email to