I have a function but can't success to make it recursive. This is my function without recursion :
function resolution_recursion($tab1, $tab2){
$solution = [];
foreach($tab2 as $nb2){
foreach($tab1 as $nb1){
if(($nb2 + $nb1)%2 != 1){
$solution[] = $nb2 + $nb1;
}
}
}
return $solution;
}
And I would like to make it recursive to make it work like :
$nb_ajout = [2];
$next = [[1,2],[3,4],[5,6],[7,8]];
resolution_recursion(
resolution_recursion(
resolution_recursion(
resolution_recursion($nb_ajout, $next[0]),
$next[1]),
$next[2]),
$next[3]);
I can't find the solution, if you can help me.