As I thought, once the answer came it wasn't that tough. It just twisted my mind for a bit for some reason. heres the code:
//the starting array
$a[0] = "abc";
$a[1] = "def";
$a[2] = "ghi";
//the output word for this iteration,
//as an array:
$word = array();
//just a counter to make sure the right
//amount of words are generated.
$counter = 0;
function doit($array, $level = 0)
{
global $word;
global $counter;
/this loop iterates for each value in the
column, represented by $level./
for($i = 0; $i < sizeof($array); $i++)
{
$word[$level] = $array[$i][$level];
if($level < (strlen($array[0]) - 1))
{
/*if there is a next column,
increment the layer and do the
funtion again*/
doit($array, ($level + 1));
}
else
{
//output the string
$temp = "";
foreach($word as $value)
$temp .= $value;
$counter ++;
echo "<br> value ".$counter.": ".$temp."\n";
}
}
}
doit($a);