Here's what I came up with.
function flattenArray($a) {
// reduce raw matrix to single level matrix of matrices
// that will be the rows in results table.
$r1 = array();
$r2 = array();
foreach ($a as $k1 => $v1) {
foreach ($v1 as $k2 => $v2) {
foreach ($v2 as $k3 => $v3) {
$r2 = array_merge($r2, array($k3 => $v3));
}
}
array_push($r1, $r2);
}
return $r1;
} // end flattenArray($a)
BTW: I'm discovering that many of my difficulties are a side effect of
the fact that I started working with php and cakePHP at the same time.
So, I have tended to miss the distinction between functions in the
base language and the framework. So, (I'm probably stating the obvious
here) as I get a better handle on the language itself I get an ever
increasing appreciation for the framework and how to use it. I'm
starting to see _obvious_ choices on how to better segregate my code
between models-views-controllers and how to interpret the debug()
output. (I think it was @WebbedIT that said: 'debug is your friend.')
Many thanx to all who offer help. McS
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php