note 42661 deleted from function.sqrt by didou

From: Date: Tue, 31 Aug 2004 01:33:06 +0000
Subject: note 42661 deleted from function.sqrt by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-75703@lists.php.net to get a copy of this message
Note Submitter: aerøn ---- 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.

« previous php.notes (#75703) next »