473,834 Members | 1,460 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 3600
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
10507
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
4595
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
18601
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
1663
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 and releases the UI. I've tried the following two documented methods to make the timeout period 3...
3
8214
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
1063
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
7908
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
24202
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
1923
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 comparing running times. I wanted to see how much improvement could give vectorization to simple...
0
9796
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10790
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10505
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10214
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9329
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6952
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5624
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4425
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
3
3079
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.