Jump to content

Recommended Posts

first look at my arrays
[code]
//my first array
Array
(
    [key1] => Array
        (
            [0] => Value1
            [1] => Value2
            [2] => Value3
            [3] => Value4
            [4] => Value5
            [5] => Value6
            [6] => Value7
            [7] => Value8
            [8] => Value9
        )

    [key2] => Array
        (
            [0] => Value1
            [1] => Value2
            [2] => Value3
        )

    [key3] => Array
        (
            [0] => Value2
            [1] => Value2
        )

)

//my second array

Array
(
    [key1] => Array
        (
            [6] => Value7
            [7] => Value8
            [8] => Value9
        )

    [key2] => Array
        (
            [0] => Value1
        )

    [key3] => Array
        (
            [0] => Value2
        )

)
[/code]

Now there is a way to get an array that is the result of array1 less array2? and other that is what array2 have that array1 doesn't have, using native php functions?

tks
Link to comment
https://forums.phpfreaks.com/topic/15177-array-difference/
Share on other sites

I'm trying to use this functions but no functional results....

array_diff($array1, $array2) returns empty array

array_diff($array2, $array1) returns empty array

array_intersect($array1, $array2) returns array2

array_intersect($array2, $array1) return array1

don't know how to get array1 - array2...
Link to comment
https://forums.phpfreaks.com/topic/15177-array-difference/#findComment-61215
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.