Program to calculate area and perimeter of a rhombus whose diagonals are given | calculate area and perimeter of a rhombus ; Driver code
< ? php function rhombusAreaPeri ( $ d1 , $ d2 ) { $ area = ( $ d1 * $ d2 ) / 2 ; $ perimeter = 2 * sqrt ( pow ( $ d1 , 2 ) + pow ( $ d2 , 2 ) ) ; echo " The ▁ area ▁ of ▁ rhombus ▁ with ▁ diagonals ▁ " . $ d1 . " ▁ and ▁ " . $ d2 . " ▁ is ▁ " . $ area . " . " . " STRNEWLINE " ; echo " The ▁ perimeter ▁ of ▁ rhombus ▁ with ▁ diagonals ▁ " . $ d1 . " ▁ and ▁ " . $ d2 . " ▁ is ▁ " . $ perimeter . " . " . " STRNEWLINE " ; } $ d1 = 2 ; $ d2 = 4 ; rhombusAreaPeri ( $ d1 , $ d2 ) ; ? >