DEV Community

sibafo rudy zidane
sibafo rudy zidane

Posted on

misunderstanding the result of this code

good evening geeks I hope you are well. Please, I would like you to enlighten me on one point. I don't understand the result of this php code it shows me 13. I really don't understand why. Need explanation. I want to clarify that I am a beginner Thank you in advance friends!

<?php
$total = 0;
$i = 1;
while ($i<=2) {
$total += $i;
$i =$i +1 ;
echo $total;
}
?>

Top comments (0)