RE: [PHP] sort multidimension array

2006-06-22 Thread Ford, Mike
On 22 June 2006 02:22, weetat wrote: Hi all, I have multi-arrays as shown below: I implemented usort() to sort the array by 'country' field in the array. However there some empty string value in the array and i setup my cmpcountry() function to sort array, however , some country

[PHP] sort multidimension array

2006-06-21 Thread weetat
Hi all, I have multi-arrays as shown below: I implemented usort() to sort the array by 'country' field in the array. However there some empty string value in the array and i setup my cmpcountry() function to sort array, however , some country empty string value are sort first . Any ideas

Re: [PHP] sort multidimension array

2006-06-21 Thread David Tulloh
Examine your function for the case of cmpcountry(Thailand, ); if($country2 == '') is true if($country1 $country2) is false Then ($country1 $country2) is false again and 1 is returned. This means that is less than Thailand, and should be sorted higher. The easiest way to fix this is actually

Re: [PHP] sort multidimension array

2006-06-21 Thread weetat
Hi David , Thanks for your input, it solve my problem. David Tulloh wrote: Examine your function for the case of cmpcountry(Thailand, ); if($country2 == '') is true if($country1 $country2) is false Then ($country1 $country2) is false again and 1 is returned. This means that is less

[PHP] Sort multi array.

2005-08-13 Thread João Cândido de Souza Neto
I´ve in a array the coluns: date , weekday , hour , etc... I need to sort him by coluns 0 and 2 but not found the correctly function to do it. Please, anyone know how can i do? Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Sort multi array.

2005-08-13 Thread Torgny Bjers
João Cândido de Souza Neto wrote: I´ve in a array the coluns: date , weekday , hour , etc... I need to sort him by coluns 0 and 2 but not found the correctly function to do it. Take a look at this manual page: http://www.php.net/manual/en/function.array-multisort.php Regards, Torgny -- PHP

[PHP] sort multidim array

2004-10-05 Thread Kevin Coyner
I've been banging my head against the wall on this one. Probably trivial to the knowledgeable, but I'm stumped despite trying the various sort functions as advertised on php.net. I've got the following fields: retailer city state telephone distance Sample data looks like: BLIND BROOK

Re: [PHP] sort multidim array

2004-10-05 Thread Jasper Howard
This was just discusses in quite some detail. Everyone decieded that usort() was the best and a couple peopel agreed that array_multisory() works just fine. Check out that convo to get some pretty good details on how to do this. On Tue, 05 Oct 2004 13:04:44 -0400, Kevin Coyner [EMAIL PROTECTED]

[PHP] Sort multidimensional array - ARGH!

2004-02-05 Thread Kim Steinhaug
I have been messing around now for some hours and Im going mad! Im pulling some heavy data from mySQL with count and grouping, after this I have to calculate som values and then sort the outcome. Therefore Im not able to let mySQL do the accuall sort. So i stuff it into an array, and I need to

Re: [PHP] Sort multidimensional array - ARGH!

2004-02-05 Thread Tom Rogers
Hi, Thursday, February 5, 2004, 11:35:34 PM, you wrote: KS I have been messing around now for some hours and Im going mad! KS Im pulling some heavy data from mySQL with count and grouping, KS after this I have to calculate som values and then sort the outcome. KS Therefore Im not able to let

[PHP] Sort an array of objects

2003-10-01 Thread Matt Palermo
I have an array of object for files on my site. The objects hold a file's name, size, extension, etc... I was wondering if anyone knows where I could find a relatively easy function for sorting the array of these objects by either name, size, etc... Please let me know if got any tips. Thanks a

Re: [PHP] Sort an array of objects

2003-10-01 Thread Marek Kilimajer
Matt Palermo wrote: I have an array of object for files on my site. The objects hold a file's name, size, extension, etc... I was wondering if anyone knows where I could find a relatively easy function for sorting the array of these objects by either name, size, etc... Please let me know if got

[PHP] sort mixed array

2003-02-27 Thread Jim Long
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

[PHP] Sort multidimensional array using Natural-Order

2002-08-18 Thread Hessu
Hi, I have following filename/date array Array ( [0] = Array ( [0] = 1.jpg [1] = 10.jpg [2] = 11.jpg [3] = 12.jpg [4] = 2.jpg [5] = 3.jpg [6] = 4.jpg [7] = 5.jpg [8] = 6.jpg [9] = 7.jpg [10] = 8.jpg [11] = 9.jpg ) [1] = Array ( [0] = 1026502301 [1] = 1026502312 [2] = 1026502313 [3] = 1026502550

[PHP] Sort multidimensional array using Natural-Order

2002-08-18 Thread Hessu
Hi, I have following filename/date array Array ( [0] = Array ( [0] = 1.jpg [1] = 10.jpg [2] = 11.jpg [3] = 12.jpg [4] = 2.jpg [5] = 3.jpg [6] = 4.jpg [7] = 5.jpg [8] = 6.jpg [9] = 7.jpg [10] = 8.jpg [11] = 9.jpg ) [1] = Array ( [0] = 1026502301 [1] = 1026502312 [2] = 1026502313 [3] = 1026502550

[PHP] Sort multidimensional array using Natural-Order

2002-08-18 Thread Hessu
Hi, I have following filename/date array Array ( [0] = Array ( [0] = 1.jpg [1] = 10.jpg [2] = 11.jpg [3] = 12.jpg [4] = 2.jpg [5] = 3.jpg [6] = 4.jpg [7] = 5.jpg [8] = 6.jpg [9] = 7.jpg [10] = 8.jpg [11] = 9.jpg ) [1] = Array ( [0] = 1026502301 [1] = 1026502312 [2] = 1026502313 [3] = 1026502550

[PHP] Sort an array by its values

2001-07-08 Thread Aaron Bennett
Hi All, I'm trying to sort an array of objects by the value of one of those objects... for instance, I'll have an object with 2 properties, id and score, where id is unique and score is its relevant (and sometimes simelar) score. i've tried using sort() and asort() but i can't figure how to

Re: [PHP] Sort an array by its values

2001-07-08 Thread Chris Lambert - WhiteCrown Networks
*/ - Original Message - From: Aaron Bennett [EMAIL PROTECTED] To: Php-General (E-mail) [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 4:25 AM Subject: [PHP] Sort an array by its values | Hi All, | I'm trying to sort an array of objects by the value of one of those | objects

RE: [PHP] Sort an array by its values

2001-07-08 Thread Aaron Bennett
: Sunday, July 08, 2001 1:33 AM To: Aaron Bennett Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Sort an array by its values Do you mean something like www.php.net/ksort or www.php.net/krsort? I'm not sure of the actual structure of your array, though, so those might not work as expected. /* Chris Lambert

Re: [PHP] Sort an array by its values

2001-07-08 Thread Chris Lambert - WhiteCrown Networks
PROTECTED]; Aaron Bennett [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Sunday, July 08, 2001 4:34 AM Subject: RE: [PHP] Sort an array by its values | Chris, | I'm looking at ksort as i type... the problem i'm having is that i'm | trying to sort a value inside an object inside that array (rather

RE: [PHP] Sort an array by its values

2001-07-08 Thread Andrew Braund
: [PHP] Sort an array by its values Hi All, I'm trying to sort an array of objects by the value of one of those objects... for instance, I'll have an object with 2 properties, id and score, where id is unique and score is its relevant (and sometimes simelar) score. i've tried using sort

RE: [PHP] Sort an array by its values

2001-07-08 Thread Aaron Bennett
- From: Chris Lambert - WhiteCrown Networks [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 08, 2001 1:38 AM To: Aaron Bennett Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Sort an array by its values Can you print_r($variable) and post it here? /* Chris Lambert, CTO - [EMAIL PROTECTED] WhiteCrown

Re: [PHP] Sort an array by its values

2001-07-08 Thread Justin Farnsworth
Try something like: uasort($your_hash[$first_level][$any_second_level], create_function('$a,$b', 'return $a[what_level] - $b[what_level];')); and adjust this according to the level and what you want to sort on accordingly... _jef Aaron Bennett wrote: Hi All,

[PHP] Sort an array

2001-04-30 Thread Brandon Orther
Hello, Is there a way to sort an array alphabetically? Brandon -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]

Re: [PHP] Sort an array

2001-04-30 Thread Miles Thompson
The PHP online manual is very easy to use. Start at http://www.php.net/array and you'll find all the functions that act on array downl the left side of your browser, including a fantastically rich set of sort options. Miles At 12:19 PM 4/30/01 -0700, Brandon Orther wrote: Hello, Is there a

[PHP] sort multidimensional array?

2001-03-27 Thread phpman
Hello, i have this code: while ($row = mysql_fetch_array($results)) { $tmp = get_item_reorder_priority($row["item_sku"]); $list[$r]["priority"] = $tmp[0]; $list[$r]["sku"] = $row["item_sku"]; $r++; } $list = array_multisort($list["priority"], SORT_NUMERIC, SORT_DESC);

Re: [PHP] sort multidimensional array?

2001-03-27 Thread Stuart J. Browne
while ($row = mysql_fetch_array($results)) { $tmp = get_item_reorder_priority($row["item_sku"]); $list[$r]["priority"] = $tmp[0]; $list[$r]["sku"] = $row["item_sku"]; $r++; } $list = array_multisort($list["priority"], SORT_NUMERIC, SORT_DESC); and it returns this

Re: [PHP] sort multidimensional array?

2001-03-27 Thread phpman
I'm still confused. I'm looking to sort the list[$r] part of the array based on what value $list[$r]["priority"] is. What would the function's arguments be? ""Stuart J. Browne"" [EMAIL PROTECTED] wrote in message 99rajk$i0v$[EMAIL PROTECTED]">news:99rajk$i0v$[EMAIL PROTECTED]... while ($row =