0

Can some one help me to understand this PHP question please? $result = 0; and $i = 0; how can their addition be 10???

function func($arg) { $result = 0; for($i=0; $i<$arg; $i++) { $result = $result + $i; } return $result; } echo func(5);

4th Nov 2016, 3:56 PM
Haikal Jama Shaywal
1 Odpowiedź
0
1+2+3+4=10 The for loop add the numbers http://www.w3schools.com/php/php_looping_for.asp
8th Nov 2016, 6:34 AM
மனோஜ்குமார் பழனிச்சாமி
மனோஜ்குமார் பழனிச்சாமி - avatar