note 42661 added to function.sqrt
| From: | "aer�n" at rn2 dot php dot net | Date: | Tue, 25 May 2004 18:15:34 +0000 |
| Subject: | note 42661 added to function.sqrt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70073@lists.php.net to get a copy of this message | ||
This is a just a demonstration of how to use sqrt(); correctly with an array and for loop. --
someone had a problem with this at a forum.
<?
$number = array ("4", "9", "16", "25", "36",
"49", "64", "81", "100");
for ($x=0; $x<count($number); $x++)
{
$squ = sqrt($number[$x]);
print "Square root of $number[$x] is $squ.<br>";
}
?>
The output is:
Square root of 4 is 2. Square root of 9 is 3. Square root of 16 is 4. Square root of 25 is 5. Square
root of 36 is 6. Square root of 49 is 7. Square root of 64 is 8. Square root of 81 is 9. Square root
of 100 is 10.
----
Manual Page -- http://www.php.net/manual/en/function.sqrt.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42661
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42661&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42661&report=yes
Search -- http://master.php.net/manage/user-notes.php