[PHP] Sorting Arrays

2008-08-22 Thread Tom Shaw
I'm having a problem sorting my array and wondered if anybody had experience sorting arrays by their values. What I need to do is resort the array below where the most expensive product shipping price starts at position zero no matter how big the array is. array(2) { [0] = array(48) {

Re: [PHP] Sorting Arrays

2008-08-22 Thread Micah Gersten
I believe you'll need a custom sorting function for this. http://us.php.net/usort Thank you, Micah Gersten onShore Networks Internal Developer http://www.onshore.com Tom Shaw wrote: I'm having a problem sorting my array and wondered if anybody had experience sorting arrays by their values.

Re: [PHP] Sorting Arrays

2008-08-22 Thread Ashley Sheridan
Yeah, a bubble sorting algorithm should fix it, as it essentially only a very simple sort required. Ash www.ashleysheridan.co.uk ---BeginMessage--- I believe you'll need a custom sorting function for this. http://us.php.net/usort Thank you, Micah Gersten onShore Networks Internal Developer

Re: [PHP] Sorting Arrays

2008-08-22 Thread Robert Cummings
message attachment, Forwarded message - Re: [PHP] Sorting Arrays Forwarded Message From: Micah Gersten [EMAIL PROTECTED] To: Tom Shaw [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] Sorting Arrays Date: Fri, 22 Aug 2008 14:18:53 -0500 I believe

Re: [PHP] Sorting Arrays

2008-08-22 Thread Micah Gersten
Robert Cummings wrote: On Fri, 2008-08-22 at 21:04 +0100, Ashley Sheridan wrote: Yeah, a bubble sorting algorithm should fix it, as it essentially only a very simple sort required. Why use bubble sort when you can use usort() function with an arbitrary handler? Cheers, Rob.

Re: [PHP] Sorting Arrays

2008-08-22 Thread Jim Lucas
Tom Shaw wrote: I'm having a problem sorting my array and wondered if anybody had experience sorting arrays by their values. What I need to do is resort the array below where the most expensive product shipping price starts at position zero no matter how big the array is. array(2) {

Re: [PHP] sorting arrays

2005-03-10 Thread Dotan Cohen
On Wed, 9 Mar 2005 15:11:11 -0800 (PST), Richard Lynch [EMAIL PROTECTED] wrote: Any newbie could RTFM and not get that when you see: bool arsort ( array array [, int sort_flags] ) the bool up front tells you that the function returns a boolean (true/false) value. That should in the

Re: [PHP] sorting arrays

2005-03-09 Thread Richard Lynch
Say I create a matches array from a set of SQL queries With each query, an entry is added to my matches array. If the name already exists, its value gets incremented. How can I sort the array based on the highest number of hits? What is the sort method? Say this is the array:

Re: [PHP] sorting arrays

2005-03-09 Thread Robert Cummings
On Wed, 2005-03-09 at 18:11, Richard Lynch wrote: Say I create a matches array from a set of SQL queries With each query, an entry is added to my matches array. If the name already exists, its value gets incremented. How can I sort the array based on the highest number of hits? What

[PHP] sorting arrays

2005-03-08 Thread Brian A. Anderson
Say I place the results of a set of database queries -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] sorting arrays

2005-03-08 Thread Brian A. Anderson
Say I create a matches array from a set of SQL queries With each query, an entry is added to my matches array. If the name already exists, its value gets incremented. How can I sort the array based on the highest number of hits? What is the sort method? Say this is the array: array('lma-bg51' =

Re: [PHP] sorting arrays

2005-03-08 Thread Guillermo Rauch
Hello Brian, Everytime you're looking for an specific function to do some job, look at the php functions list. In this case: http://ar2.php.net/manual/es/ref.array.php These are the most common ones i use: array_reverse usort uksort uasort and obviusly sort Hope this helps, Guillermo Rauch

RE: [PHP] sorting arrays

2005-03-08 Thread Chris Rose
Say I create a matches array from a set of SQL queries with each query, an entry is added to my matches array. If the name already exists, its value gets incremented. How can I sort the array based on the highest number of hits? What is the sort method? Say this is the array:

Re: [PHP] sorting arrays

2005-03-08 Thread Robert Cummings
On Tue, 2005-03-08 at 18:24, Brian A. Anderson wrote: Say I create a matches array from a set of SQL queries With each query, an entry is added to my matches array. If the name already exists, its value gets incremented. How can I sort the array based on the highest number of hits? What is

Re: [PHP] sorting arrays

2005-03-08 Thread Ligaya Turmelle
have you looked at the various array sorting functions available? http://www.php.net/manual/en/ref.array.php Brian A. Anderson wrote: Say I create a matches array from a set of SQL queries With each query, an entry is added to my matches array. If the name already exists, its value gets

Re: [PHP] sorting arrays

2005-03-08 Thread Brian A. Anderson
Message - From: Chris Rose [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tuesday, March 08, 2005 5:26 PM Subject: RE: [PHP] sorting arrays Say I create a matches array from a set of SQL queries with each query, an entry is added to my matches array. If the name already exists

[PHP] sorting arrays

2005-03-08 Thread Gabino Travassos
Hello List I've looked at array_multisort( ), but it doesn't seem like the right function. Here's an example of my array, it's a listing of CD reviews: $cds=array(array(Lowest of the Low, 20050105,9,Toronto), array(Heavy Blinkers,20041020,6,Chicago), array(Apple,Fiona,20050308,5,Seattle)); If I

Re: [PHP] sorting arrays

2005-03-08 Thread Robert Cummings
On Tue, 2005-03-08 at 22:56, Gabino Travassos wrote: Hello List I've looked at array_multisort( ), but it doesn't seem like the right function. Here's an example of my array, it's a listing of CD reviews: $cds=array(array(Lowest of the Low, 20050105,9,Toronto), array(Heavy

Re: [PHP] sorting arrays

2005-03-08 Thread Jochem Maas
Gabino Travassos wrote: Hello List I've looked at array_multisort( ), but it doesn't seem like the right function. Here's an example of my array, it's a listing of CD reviews: $cds=array(array(Lowest of the Low, 20050105,9,Toronto), array(Heavy Blinkers,20041020,6,Chicago),

RE: [PHP] Sorting arrays

2003-12-14 Thread Jake McHenry
-Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 1:52 AM To: Jake McHenry; 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting back

RE: [PHP] Sorting arrays

2003-12-14 Thread Bronislav Klucka
Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have

RE: [PHP] Sorting arrays

2003-12-14 Thread Jake McHenry
-Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:22 AM To: Jake McHenry Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting

Re: [PHP] Sorting arrays

2003-12-14 Thread Justin Patrin
Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 1:52 AM To: Jake McHenry; 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending and by hitting

Re: [PHP] Sorting arrays

2003-12-14 Thread Justin Patrin
Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:22 AM To: Jake McHenry Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays Try to explain a little bit more how the arrays could be sorted asscending

RE: [PHP] Sorting arrays

2003-12-14 Thread Jake McHenry
-Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:51 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Sorting arrays Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday

RE: [PHP] Sorting arrays

2003-12-14 Thread Jake McHenry
-Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:55 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Sorting arrays Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday

RE: [PHP] Sorting arrays

2003-12-14 Thread Jake McHenry
-Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 2:55 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] Sorting arrays Jake McHenry wrote: -Original Message- From: Bronislav Klucka [mailto:[EMAIL PROTECTED] Sent: Sunday

RE: [PHP] Sorting arrays

2003-12-14 Thread Jake McHenry
-Original Message- From: Jake McHenry [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 3:14 AM To: 'Justin Patrin' Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Sunday, December

RE: [PHP] Sorting arrays [SOLVED I THINK]

2003-12-14 Thread Jake McHenry
-Original Message- From: Jake McHenry [mailto:[EMAIL PROTECTED] Sent: Sunday, December 14, 2003 3:14 AM To: 'Justin Patrin' Cc: 'Php-general' Subject: RE: [PHP] Sorting arrays -Original Message- From: Justin Patrin [mailto:[EMAIL PROTECTED] Sent: Sunday, December

[PHP] Sorting arrays

2003-12-13 Thread Jake McHenry
Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I am sorting. If the user hits the back button in their browser, and hits submit again without changing anything, the array is sorted again, now in decending

RE: [PHP] Sorting arrays

2003-12-13 Thread Bronislav Klucka
Try to explain a little bit more how the arrays could be sorted asscending and by hitting back and submitting form suddnely sorted descending... Brona Does anyone know of a way to keep sort from reversing the array order? That is kinda fuzzy, let me explain. I have a couple arrays that I

[PHP] Sorting Arrays

2003-02-25 Thread Bill MacAllister
Hello, I am running PHP 4.2.2 on an Alpha Linux system. The array sorting functions don't seem to be doing anything, i.e. pass an array in and get exactly the same thing back. I have tried to isolate the problem by just cutting a simple example out of the documentation, for example the

[PHP] Sorting arrays

2003-01-11 Thread Chris Kay
I have a array as below I wish to sort if by the key fff name = blah fff = 4 join = pppop name = ttoo fff = 3 join = wewe name = blff fff = 9 join = ppeep Any1 know of a quick way to do this, I have been looking at the sorting of arrays in the Manual but cant see anything.. Thanks in advance