0

I created a function to obtain the difference between two arrays of different sizes but this does not satisfy me so I would like to ask for your help to resolving this matter.

first array:

            Array
            (
                [0] => Array
                    (
                        [filename] => .ftpquota
                        [dirpath] => /home/gdwiapid/polizze/
                        [modtime] => 1419357883
                        [md5] => 6a3feb19f3d0aaf7d649dacb4e23668c
                    )

                [1] => Array
                    (
                        [filename] => content.tp.php
                        [dirpath] => /home/gdwiapid/polizze//portal/links/custom/show/_tp
                        [modtime] => 1419262814
                        [md5] => 49da61a39dd569159ae661db9616731e
                    )

                [2] => Array
                    (
                        [filename] => new_compare.php
                        [dirpath] => /home/gdwiapid/polizze/
                        [modtime] => 1419357883
                        [md5] => f9f6865fa262e3b4246f5caa8c235f68
                    )

                [3] => Array
                    (
                        [filename] => blabla
                        [dirpath] => blabla
                        [modtime] => 1419261133
                        [md5] => 5624306ac9327fa5ed350403ac310e1a
                    )

            )

second array:

            Array
            (
                [0] => Array
                    (
                        [filename] => .ftpquota
                        [dirpath] => /home/gdwiapid/polizze/
                        [modtime] => 1419357883
                        [md5] => 6a3feb19f3d0aaf7d649dacb4e23668c
                    )

                [1] => Array
                    (
                        [filename] => content.tp.php
                        [dirpath] => /home/gdwiapid/polizze//portal/links/custom/show/_tp
                        [modtime] => 1419262814
                        [md5] => 49da61a39dd569159ae661db9616731e
                    )

                [2] => Array
                    (
                        [filename] => new_compare.php
                        [dirpath] => /home/gdwiapid/polizze/
                        [modtime] => 1419357883
                        [md5] => 9a17fd00b6b12ff709bdfddcab492c88
                    )

            )

result should be:

            Array
            (
                [0] => Array
                    (
                        [filename] => blabla
                        [dirpath] => blabla
                        [modtime] => 1419261133
                        [md5] => 5624306ac9327fa5ed350403ac310e1a
                    )

                [1] => Array
                    (
                        [filename] => new_compare.php
                        [dirpath] => /home/gdwiapid/polizze/
                        [modtime] => 1419357883
                        [md5] => 9a17fd00b6b12ff709bdfddcab492c88
                    )

            )

Any help would be much appreciated! Happy coding and Marry Christmas!

  • Plz show the function you wrote. – mopo922 Dec 23 '14 at 18:15
  • possible duplicate of [recursive array\_diff()?](http://stackoverflow.com/questions/3876435/recursive-array-diff) – mopo922 Dec 23 '14 at 18:16
  • Please add the function you're currently using and the result you're getting. – vicente Dec 23 '14 at 18:21
  • Are the md5 values unique enough to use them as keys? If so, instead of using 0, 1, 2, 3... as the index values, use the md5 values. Then, given any record, you can see if isset, !empty, or array_key_exists using the md5 value. Many ways to do the same thing: is the md5 value a key in the other array? – kainaw Dec 23 '14 at 18:56

0 Answers0