how to dynamically generate list of arguments to pass to array_diff

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I have an array of arrays like this:
---
[array_of_arrays:private] => Array
        (
            [0] => Array
                (
                    [0] => 2
                    [1] => 4
                    [2] => 5
                    [3] => 17
                    [4] => 80
                )

            [1] => Array
                (
                    [0] => 5
                    [1] => 7
                    [2] => 9
                    [3] => 2
                    [4] => 16
                    [5] => 58
                )

            [2] => Array
                (
                    [0] => 2
                    [1] => 4
                    [2] => 6
                    [3] => 8
                    [4] => 37
                    [5] => 92
                )

        )
---
and I want to do an array_diff on them so that I get something like this back:
---
Array
(
    [0] => 6
    [1] => 7
    [2] => 8
    [3] => 9
    [4] => 16
    [5] => 17
    [6] => 37
    [7] => 58
    [8] => 80
    [9] => 92
)
---

The arrays above are just an example; the real arrays I am working with can have many more elements (in the tens of thousands).  Also, there can be a variable number of subarrays.  I have written several different versions of my own array_diff that iterates over all the subarrays but they are slow.

My question is is there a way to call the built-in array_diff with a dynamically generated list of arguments?  I was thinking maybe there would be a way to do this with variable variables or if I generated a string that could be parsed by PHP but I have only succeeded in confusing myself further.  Thanks for any suggestions.

Mari
-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux