0

Could someone explain why the result is 21 for this I don't get it. Thank you.

function math($t){ if ($t==0) return 0; return $t+math($t-1); } echo math(6);

19th Sep 2019, 10:08 PM
Vitalie Melnic
Vitalie Melnic - avatar
2 ответов
0
Makes sense I was thinking of it like an if statement that would break after one iteration thanks a lot
19th Sep 2019, 10:14 PM
Vitalie Melnic
Vitalie Melnic - avatar