note 42366 deleted from function.sqrt by tularis
| From: | tularis@php.net | Date: | Thu, 16 Feb 2012 16:35:43 +0000 |
| Subject: | note 42366 deleted from function.sqrt by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-186175@lists.php.net to get a copy of this message | ||
Note Submitter: php user
----
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;
?>