Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: array functions

  1. #1
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts

    array functions

    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.
    Last edited by NancyJ; 08-31-2007 at 11:58 AM. Reason: doh! found it the second I posted - array_intersect

  • #2
    New Coder
    Join Date
    Jun 2007
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.
    PHP / CSS / Perl / XML / XHTML

    For cheap ipod touch go to protella.com

  • #3
    Regular Coder
    Join Date
    May 2006
    Location
    Wales
    Posts
    820
    Thanks
    1
    Thanked 82 Times in 79 Posts

  • #4
    Registered User
    Join Date
    Jul 2007
    Posts
    20
    Thanks
    3
    Thanked 0 Times in 0 Posts
    use array_merge() function to combine two arrays.for more info visit http://www.w3schools.com/php/func_array_merge.asp
    Last edited by venkib097; 08-31-2007 at 02:52 PM.

  • #5
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    Quote Originally Posted by Mwnciau View Post
    Winner

  • #6
    Senior Coder NancyJ's Avatar
    Join Date
    Feb 2005
    Location
    Bradford, UK
    Posts
    3,174
    Thanks
    19
    Thanked 66 Times in 65 Posts
    Quote Originally Posted by Inigoesdr View Post
    Winner
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •