View Full Version : array functions
08-31-2007, 10:56 AM
I've been going through the manual looking for a function but I can't find it but maybe someone here knows whether it exists and what it might be called.
I have 2 arrays, I want to reduce those arrays to a single array that only contains the values that exist in both arrays.
08-31-2007, 12:36 PM
i cant think of one off the top of my head, but writing something like this would be simple enough.
Just loop one of them and for each value do an in_array() on the other one, if thats true then popultate a new one.
Other than that, in the 5 seconds i've looked, no idea.
08-31-2007, 12:49 PM
08-31-2007, 01:46 PM
use array_merge() function to combine two arrays.for more info visit http://www.w3schools.com/php/func_array_merge.asp
08-31-2007, 02:37 PM
08-31-2007, 02:43 PM
I'm the winner ;) Post deleting has gone away again but I found the answer 2 minutes after posting
Last edited by NancyJ : 08-31-2007 at 10:58 AM. Reason: doh! found it the second I posted - array_intersect
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.