hypot() function in PHP

PHPProgrammingServer Side Programming

The hypot() function is used to calculate the hypotenuse of a right-angle triangle. It Returns the length of the hypotenuse in float. Of a right-angled triangle, the longest side is hypotenuse.

Hypot

Syntax

hypot(a, b)

Parameters

  • a − Length of first side

  • b − Length of second side

Return

The hypot() function Returns the length of the hypotenuse in float.

Example

 Live Demo

<?php
   echo hypot(2,8) . "<br>";
   echo hypot(8,3);
?>

Output

8.2462112512353<br>8.5440037453175
raja
Published on 09-Nov-2018 06:59:54
Advertisements