What is Area in Mathematical ?
Area is the size and amount of two-dimensional space taken up by an object.Like Square , Equilateral Triangle , Circle , Rectangle, Parallelogram , Triangle , Ellipse and Trapezoid.
Function
/*Same Size Sides*/ function square($var) { return $var * $var; } function equilateral_triangle($side) { return 0.43301 * ($side * $side); } /*Two Different Size Sides*/ function rectangle($vala, $valb) { return $vala * $valb; } function parallelogram($base, $height) { return $base * $height; } function triangle($base, $height) { return 0.5 * $base * $height; } /*One Radius*/ function circle($radius) { return 3.14 * ($radius * $radius); } /*Two Different Radius*/ function ellipse($radius1, $radius2) { return 3.14 * $radius1 * $radius2; } /*Two Different Base*/ function trapezoid($height, $base1, $base2) { return (($base1 + $base2) / 2) * $height; } echo square(4); // 16 echo equilateral_triangle(4); // 6.92816 echo circle(15); // 706.5 echo rectangle(15,15); // 225 echo parallelogram(15,5); // 75 echo triangle(15,5); // 37.5 echo ellipse(15,5); // 235.5 echo trapezoid(10,10,10); // 100
Demo
(Visited 2,456 times, 1 visits today)
Written by: