+ 1
Could you explain -> function returns itself in php
function func($x) { İf ($x == 0) { return 0; } else { return $x + func($x - 1); } } echo func(6); //output : 21
1 Resposta
+ 6
It is recursion. It occurs when function can call itself. We can present this case such way: 6+5+4+3+2+1+0 = 21