PHP program to calculate the area of an equilateral triangle
ADVERTISEMENTS
PHP program to calculate the area of an equilateral triangle. There are you will learn how to find the area of an equilateral triangle in PHP language.
Formula:
a = (sqrt(3) / 4) * (s * s)
Where:
a = area
s = side
Let us understand this example through the PHP program:
<?php
// PHP program to calculate the area of an equilateral triangle
$s = 7;
$a = NULL;
// s = side
// a = area
// Calculate area of equilateral triangle
$a = (sqrt(3) / 4) * ($s * $s);
// Output
echo "Area of the equilateral triangle = " . $a . " sq. units";
?>
Output:
Area of the equilateral triangle = 21.217622392719 sq. units