Re: [SOLVED] [PHP] how to dynamically generate list of arguments to pass to array_diff

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

 



On Feb 18, 2011, at 12:03 PM, Simon J Welsh wrote:

> 
> On 19/02/2011, at 8:07 AM, Mari Masuda wrote:
>> 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
> 
> call_user_func_array('array_diff', $this->array_of_arrays);
> 
> http://php.net/call_user_func_array
> 
> Though from your example, passing multiple arrays to array_diff is not what you're after, as it just returns the items in the first array that are not in any of the others.
> ---
> Simon Welsh
> Admin of http://simon.geek.nz/
> 
> Who said Microsoft never created a bug-free program? The blue screen never, ever crashes!
> 
> http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e
> 

Hi Simon,

Thank you for the info on call_user_func_array and for pointing out my error!  (That bug would partially explain why I have been beating my head against the wall for the last several days.)  call_user_func_array is exactly what I need.  Thanks again!

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