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) {
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.
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
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
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.
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) {
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
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:
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
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
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' =
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
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:
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
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
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
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
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
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),
-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
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
-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
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
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
-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
-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
-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
-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
-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
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
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
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
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
33 matches
Mail list logo