Hi, this is really a general programming question, I have come across it a few times in my work and not really known how to handle it. I have normally ended up just coding it manually (putting in all the combinations), but I guess there must be a better way.

Say I have an array, (0, 1, 2, 3, 4, 5) and I want to put them into a function called do_something($a, $b, $c, $d, $e, $f) but I want this function to be called for every combination of numbers so do_something(0, 1, 2, 3, 4, 5), do_something(0, 1, 2, 3, 5, 4) etc.

I guess you could do it with for loops but when dealing with say 9 variables, it would be slow and I guess not the most efficient way to do it.

Any ideas on how to go about this?

Many thanks