473,545 Members | 2,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

combine two arrays ldap_search results to give one array with uniquevalues?

Hi,

I'm doing an two ldap_search queries and I need to combine the two
results into one single array containing all the results from each but
removing duplicates.

I have tried built in php functions such as array_merge (which gives
me duplicates) and array_unique which does not work either.
Any ideas?

Thanks.
Nov 3 '08 #1
5 3590
On Sun, 2 Nov 2008 17:01:07 -0800 (PST), pt*******@googl email.com
wrote:
Hi,

I'm doing an two ldap_search queries and I need to combine the two
results into one single array containing all the results from each but
removing duplicates.

I have tried built in php functions such as array_merge (which gives
me duplicates) and array_unique which does not work either.
Any ideas?

Thanks.
Yes, you can use array_diff(), which will look at the arrays' valus.
Note that the key associativity of the first array is maintained in
the return array.

<URL:http://php.net/array_diff>
--
Curtis
$email = str_replace('si g.invalid', 'gmail.com', $from);
Nov 3 '08 #2
That wont work. I need all the unique values from both arrays in one
array, not just the difference. but thanks...
Nov 3 '08 #3
Am Mon, 03 Nov 2008 04:19:02 -0800 schrieb macca:
That wont work. I need all the unique values from both arrays in one
array, not just the difference. but thanks...
have not done much php lately but does a combination of merge and unique
not work? something like this:

$arrRes= array_unique(ar ray_merge($arr1 ,$arr2));

hope its not a stupid sugestion ... first try of use net by my side ...

cu
Nov 3 '08 #4
yes i have tried this to no avail but thanks for the suggestion
Nov 3 '08 #5
On Mon, 3 Nov 2008 04:19:02 -0800 (PST), pt*******@googl email.com
wrote:
That wont work. I need all the unique values from both arrays in one
array, not just the difference. but thanks...
Again, just looking at values, perhaps this will do it:

$a = array(...);
$b = array(...);
$c = array_merge(arr ay_diff($a,$b), array_diff($b,$ a));

--
Curtis
$email = str_replace('si g.invalid', 'gmail.com', $from);
Nov 4 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
10275
by: Sacs | last post by:
Hi all, this is _really_ bugging me, and the Google God has failed me: Doing an ldap_search of a Wink2k Active Directory trying to get the objectGUID. This is a unique id within AD and is meant to be a 128bit octal string. (16 bytes). Works 99% of the time, but the occasional objectGUID comes up short. e.g.
8
4572
by: frekster | last post by:
Hi. I used to be able to do this easily in vb 6 via looping and preserving the source array data/size etc. How can I do this in vb.net? I've been trying for a while now and this should be an easy task but it just isn't clicking. For some reason, the preserve doesn't seem to be working.
8
18582
by: nescio | last post by:
hello, i have an array and i don't know the content of it, but i want only unique values. in php there is a function to do this, but how must i do this in javascript? i have tried a lot and it is driving me nuts
0
1648
by: Max | last post by:
Hi, I've got a web GUI in which users can add server IP, ldap base, username, password to enable connectivity to Active Directory. Everything works great in the connection, etc. However, if the user adds the wrong ldap base/filter parameters (which is easy to do), the LDAP_SEARCH function will hang for the longest time before it times out...
3
8197
by: Schroeder, AJ | last post by:
Hello group, I am a relative PHP newbie and I am trying to combine two arrays together, but I also need to keep the keys of one array intact. What I am doing is two SNMP walks against a Cisco router in which I expect the script to return the interface number along with a small description of the interface type, like this: Array (
0
1051
by: Ward Germonpré | last post by:
Hi, ldap_search takes an array of attributes it is supposed to retrieve from AD. However the order in which the attributes are returned is not the same as the attributes in the array. Is there a trick around this ?
2
7895
by: chris | last post by:
I have a few byte arrays that I would like to combine into one array (order needs to be kept). What would be the most efficient way to do this? Thanks for your time, Chris
9
24154
by: nico3334 | last post by:
Hi, I have 2 arrays (Each As a String), and I would like to combine these into a new single array. Is there an easy way of coding this? For example, I want "arrData" and "arrID" to be combined into a new array: "arrTotal". If anyone could give me some coding examples, I'd greatly appreciate it. Thanks!
6
1890
by: Emiurgo | last post by:
Hi there to everyone! I've got a problem which may be interesting to some of you, and I'd be very grateful if there is someone who can give me some advice (or maybe redirect me to some other place). Very brief introduction. Since I'm learning vectorization with SSE (I use gcc 4.1.3 on Ubuntu 7.10) I've built a simple test program in C for...
0
7425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7449
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7780
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5351
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
734
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.