Re: [PHP] Sort two coupled arrays [my solution]

2010-04-09 Thread tedd
At 10:26 AM -0400 4/8/10, Robert Cummings wrote: tedd wrote: At 8:28 AM -0400 4/8/10, Andrew Ballard wrote: On Wed, Apr 7, 2010 at 6:46 PM, Ryan Sun ryansu...@gmail.com wrote: rsort(array_combine(array2, array1)); you should expect array( 'Personal Email' = 75, 'USPS mail' = 40,

Re: [PHP] Sort two coupled arrays [my solution]

2010-04-09 Thread Robert Cummings
tedd wrote: Rob: You're never confused because you are always right. I should have you mention this to my wife... I'll provide the helmet :) Congrats, you were the first to solve this problem this simply. To tell the truth, I didn't fully understand how array_multisort() worked until I

Re: [PHP] Sort two coupled arrays {my solution]

2010-04-08 Thread Andrew Ballard
On Wed, Apr 7, 2010 at 6:46 PM, Ryan Sun ryansu...@gmail.com wrote: On Wed, Apr 7, 2010 at 6:29 PM, tedd tedd.sperl...@gmail.com wrote: [snip] Let's look at the problem again (a vote collection problem): Array 1 (    [1] = 75    [2] = 31    [3] = 31    [4] = 31    [5] = 40 ) Array

Re: [PHP] Sort two coupled arrays {my solution]

2010-04-08 Thread tedd
At 6:46 PM -0400 4/7/10, Ryan Sun wrote: rsort(array_combine(array2, array1)); you should expect array( 'Personal Email' = 75, 'USPS mail' = 40, 'Personal Phone' = 31, 'Web site' = 31, 'Text Message' = 31 ) logically, the items are your key but not the count of votes Logically,

Re: [PHP] Sort two coupled arrays {my solution]

2010-04-08 Thread tedd
At 8:28 AM -0400 4/8/10, Andrew Ballard wrote: On Wed, Apr 7, 2010 at 6:46 PM, Ryan Sun ryansu...@gmail.com wrote: rsort(array_combine(array2, array1)); you should expect array( 'Personal Email' = 75, 'USPS mail' = 40, 'Personal Phone' = 31, 'Web site' = 31, 'Text Message' = 31

Re: [PHP] Sort two coupled arrays {my solution]

2010-04-08 Thread Andrew Ballard
On Thu, Apr 8, 2010 at 9:55 AM, tedd tedd.sperl...@gmail.com wrote: At 8:28 AM -0400 4/8/10, Andrew Ballard wrote: On Wed, Apr 7, 2010 at 6:46 PM, Ryan Sun ryansu...@gmail.com wrote:    rsort(array_combine(array2, array1));  you should expect array(  'Personal Email' = 75,  'USPS mail'

Re: [PHP] Sort two coupled arrays {my solution]

2010-04-08 Thread Robert Cummings
tedd wrote: At 8:28 AM -0400 4/8/10, Andrew Ballard wrote: On Wed, Apr 7, 2010 at 6:46 PM, Ryan Sun ryansu...@gmail.com wrote: rsort(array_combine(array2, array1)); you should expect array( 'Personal Email' = 75, 'USPS mail' = 40, 'Personal Phone' = 31, 'Web site' = 31, 'Text

[PHP] Sort two coupled arrays

2010-04-07 Thread tedd
Hi gang: Here's the problem -- I want to sort and combine two arrays into one sorted array. Here's a real-world example: Array 1 ( [1] = 75 [2] = 31 [3] = 31 [4] = 31 [5] = 40 ) Array 2 ( [1] = Personal Email [2] = Personal Phone [3] = Web site [4] = Text

Re: [PHP] Sort two coupled arrays

2010-04-07 Thread Piero Steinger
Am 07.04.2010 22:09, schrieb tedd: Hi gang: Here's the problem -- I want to sort and combine two arrays into one sorted array. Here's a real-world example: Array 1 ( [1] = 75 [2] = 31 [3] = 31 [4] = 31 [5] = 40 ) Array 2 ( [1] = Personal Email [2] =

Re: [PHP] Sort two coupled arrays

2010-04-07 Thread Mattias Thorslund
Piero Steinger wrote: Am 07.04.2010 22:09, schrieb tedd: Hi gang: Here's the problem -- I want to sort and combine two arrays into one sorted array. Here's a real-world example: Array 1 ( [1] = 75 [2] = 31 [3] = 31 [4] = 31 [5] = 40 ) Array 2 ( [1] = Personal Email

Re: [PHP] Sort two coupled arrays

2010-04-07 Thread Paul M Foster
On Wed, Apr 07, 2010 at 04:09:47PM -0400, tedd wrote: Hi gang: Here's the problem -- I want to sort and combine two arrays into one sorted array. Here's a real-world example: Array 1 ( [1] = 75 [2] = 31 [3] = 31 [4] = 31 [5] = 40 ) Array 2 ( [1] = Personal

Re: [PHP] Sort two coupled arrays

2010-04-07 Thread Andrew Ballard
On Wed, Apr 7, 2010 at 5:02 PM, Paul M Foster pa...@quillandmouse.com wrote: On Wed, Apr 07, 2010 at 04:09:47PM -0400, tedd wrote: Hi gang: Here's the problem -- I want to sort and combine two arrays into one sorted array. Here's a real-world example: Array 1 (     [1] = 75     [2] = 31

Re: [PHP] Sort two coupled arrays

2010-04-07 Thread Hans Åhlin
Try this insted array( [0]=array( [0]=75, [1] = Personal Email) [1]=array( [0]=31, [1] = Personal Phone) [2]=array( [0]=31, [1] = Web site) [3]=array( [0]=31, [1] = Text Message) [4]=array( [0]=40, [1] = USPS mail) MvH / Hans Åhlin Tel: +46761488019 http://www.kronan-net.com/

Re: [PHP] Sort two coupled arrays {my solution]

2010-04-07 Thread tedd
At 5:35 PM -0400 4/7/10, Andrew Ballard wrote: On Wed, Apr 7, 2010 at 5:02 PM, Paul M Foster pa...@quillandmouse.com wrote: Array indexes have to be unique regardless of whether they are numeric or strings. Ahhh, so you start to see the problem, eh? Let's look at the problem again (a vote

Re: [PHP] Sort two coupled arrays {my solution]

2010-04-07 Thread Ryan Sun
rsort(array_combine(array2, array1)); you should expect array( 'Personal Email' = 75, 'USPS mail' = 40, 'Personal Phone' = 31, 'Web site' = 31, 'Text Message' = 31 ) logically, the items are your key but not the count of votes On Wed, Apr 7, 2010 at 6:29 PM, tedd