[SOLVED] Comparing two arrays

04-08-08, 11:10 AM
|
|
Newbie Coder
|
|
Join Date: Apr 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
[SOLVED] Comparing two arrays
Hello,
I need you help folks. Struck in between.
I got two arrays.
I want to compare both the arrays and store the result in third array.
Any help will be appreciated.
Thanks
UserD
Last edited by Nico; 04-08-08 at 11:13 AM.
Reason: [php] wrappers.
|

04-08-08, 11:19 AM
|
 |
Community Liaison
|
|
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
|
|
When you say compare... you want to add them up? You want to see if they are identical? You want to add or remove similar or dissimilar values?
If you could, please give the desired result you'd expect to get from the given arrays.
__________________
The toxic ZCE
|

04-08-08, 11:29 AM
|
 |
Code Master
|
|
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
As Keith has said, without more information as to what you are wanting to do with the values, it's hard to guide you here. I suggest you take a look at the manual for a list of array functions you can use (Go down to the Table of Contents area)
Jay
|

04-08-08, 11:46 AM
|
 |
Level II Curmudgeon
|
|
Join Date: Dec 2004
Posts: 3,027
Thanks: 14
Thanked 35 Times in 33 Posts
|
|
Quote:
Originally Posted by Keith
When you say compare... you want to add them up? You want to see if they are identical? You want to add or remove similar or dissimilar values?
|
The answer is "yes".
|

04-08-08, 12:09 PM
|
|
Newbie Coder
|
|
Join Date: Apr 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry friends, just couldn't complete my question. I need to compare the first value of array1 with the first value of array2; if a1<a2, I need to store "B" to array3, else "S". The same will be from 1st element to last element of array.
Thanks
|

04-08-08, 12:27 PM
|
 |
Code Master
|
|
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
|

04-08-08, 12:34 PM
|
 |
Community Liaison
|
|
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
|
|
Quote:
Originally Posted by End User
The answer is "yes".
|
Ah, of course!
__________________
The toxic ZCE
|

04-08-08, 12:46 PM
|
|
Newbie Coder
|
|
Join Date: Apr 2008
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks a lot Jay. It works perfectly.
Bye!
|

04-08-08, 01:50 PM
|
 |
Code Master
|
|
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally Posted by Keith
Ah, of course!
|
LOL
Quote:
Originally Posted by userd
Thanks a lot Jay. It works perfectly.
Bye!
|
No worries. See ya! 
|

04-08-08, 03:11 PM
|
 |
Community Liaison
|
|
Join Date: Feb 2004
Posts: 1,232
Thanks: 1
Thanked 11 Times in 11 Posts
|
|
Quote:
Originally Posted by userd
Sorry friends, just couldn't complete my question. I need to compare the first value of array1 with the first value of array2; if a1<a2, I need to store "B" to array3, else "S". The same will be from 1st element to last element of array.
|
Now how were we unable to figure out that on our own? 
__________________
The toxic ZCE
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|