note 42366 added to function.sqrt
| From: | phpuser at rn2 dot php dot net | Date: | Thu, 13 May 2004 16:25:14 +0000 |
| Subject: | note 42366 added to function.sqrt | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69573@lists.php.net to get a copy of this message | ||
How to calculate triangle's area if you haven't height measure.
You need only sides' measure.
it would have to work.
(formula of erone)
$s1 = side 1
$s2 = side 2
$s3 = side 3
<?
function area($s1,$s2,$s3)
{
$calc1 = ($s1+$s2+$s3)/2;
$calc2 = $p*($p-$s1)*($p-$s2)*($p-$s3);
$result = round(sqrt($p),2);
return $result;
}
?>
example of I use:
<?
//This will make to return the area of a triangle with sides of 3,4,5
$area = area(3,4,5);
echo $area;
?>
----
Manual Page -- http://www.php.net/manual/en/function.sqrt.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42366
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42366&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42366&report=yes
Search -- http://master.php.net/manage/user-notes.php