I want simply to find-out better way to do this:
$array = array(
array(\'a\', \'b\', \'c\'),
array(\'e\', \'f\', \'g\'),
array(\'h\', \'i\', \'j\'
My non-recursive way:
$c) {
echo $array[$key][$c];
}
echo PHP_EOL;
} while (incrementCounter($counterArray, $upperBounds));
function incrementCounter(&$counterArray, $upperBounds)
{
if (count($counterArray) == 0 || count($counterArray) != count($upperBounds)) {
return false;
}
$counterArray[0]++;
foreach ($counterArray as $key => $value) {
if ($counterArray[$key] >= $upperBounds[$key]) {
$counterArray[$key] = 0;
if (isset($counterArray[$key+1])) {
$counterArray[$key+1]++;
}
else {
$counterArray[$key+1] = 1;
return false;
}
}
else {
break;
}
}
return true;
}