I have an array like so:
Array ( [0] => 0 [1] => 0 [2] => 0 );
there are 3 elements (3 integers) and I want them to increment from 0 to 36;
I understand that the best way for this is recursion because each element has to be checked to see if it is at the maximum ( 36 ) and if it is, it sets the last element to 0 and increments the previous.
so my array basically wants to go like:
Array ( [0] => 0 [1] => 0 [2] => 0 );
Array ( [0] => 0 [1] => 0 [2] => 1 );
Array ( [0] => 0 [1] => 0 [2] => 2 );
...
Array ( [0] => 0 [1] => 0 [2] => 36 );
Array ( [0] => 0 [1] => 1 [2] => 0 );
Array ( [0] => 0 [1] => 1 [2] => 1 );
....
Array ( [0] => 0 [1] => 1 [2] => 36 );
Array ( [0] => 0 [1] => 2 [2] => 0 );
ETC ETC ETC
But I've got no idea how to do this recursively!
However the solution also needs to work for 4 elements and 5 elements and 6 etc etc!
Can anybody give me some direction?