Jump to content

array difference


wolves

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.