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

Samual Sam
Samual Sam

Learning faster. Every day.

Updated on: 26-Jun-2020

56 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements