hypot() function in PHP



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
Updated on: 2020-06-26T09:45:55+05:30

105 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements