I used a piece of code to test the square root of some numbers in a JAVA application using 'DO' 'WHILE' functions and everything worked well. So, I decided to do the same thing using PHP. I have tried both the 'WHILE' and 'DO WHILE' functions in PHP. They both work fine except that I get an extra number. Could someone have a look at my code and see what I am doing wrong, please?
When I run the code above, I get the output below.
$i = 1;
echo "The square root of " .$i." is " .$i*$i ."<br/>";
Why do I get 6 which is an extra number added to it?
The square root of 1 is 1
The square root of 2 is 4
The square root of 3 is 9
The square root of 4 is 16
The square root of 5 is 25
Any help will be much appreciated.