Как-то так:
/**
* Generate all the possible combinations among a set of nested arrays.
* @author fabiocicerchia
* @homepage https://gist.github.com/fabiocicerchia/4556892
*
* @param array $data The entrypoint array container.
* @param array $all The final container (used internally).
* @param array $group The sub container (used internally).
* @param mixed $val The value to append (used internally).
* @param int $i The key index (used internally).
*/
function generate_combinations(array $data, array &$all = array(), array $group = array(), $value = null, $i = 0)
{
$keys = array_keys($data);
if (isset($value) === true) {
array_push($group, $value);
}
if ($i >= count($data)) {
array_push($all, $group);
} else {
$currentKey = $keys[$i];
$currentElement = $data[$currentKey];
foreach ($currentElement as $val) {
generate_combinations($data, $all, $group, $val, $i + 1);
}
}
return $all;
}
$params = array(
'param1' => array(1,2,3),
'param2' => array(1,2,3),
'param3' => array(1,2,3)
);
foreach (array_values(generate_combinations($params)) as $args) {
$object = new Object($args[0], $args[1], $args[2]);
}
Но лучше реализовать рекурсивный итератор.