Answer the question
In order to leave comments, you need to log in
Who will explain recursion to a beginner?
sobsna, I know that in the 20th line there is a recursion. How to fix?
Answer the question
In order to leave comments, you need to log in
You ended up with an infinite loop and most likely you get a memory-related error there.
In the function, you need to specify the condition under which the recursion will be called:
function myCount ($i, $l = 5){
if($i>=$l){
echo $i.' <br>';
$i++;
myCount($i, $l);
}else{
echo 'Посчитал от '. $i . ' до '. '$l';
}
}
myCount (1, 5);
the function calls itself. And does nothing more. in the 20th line, you need to replace the PrintSecond call with something constructive.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question