PHP hypot() function
Last Updated :
22 Jun, 2023
Improve
The hypot() function is a built-in mathematical function in PHP and returns the square root of sum of square of arguments passed. It finds the hypotenuse, hypotenuse is the longest side of a right angled triangle. It is calculated by the formula :
Syntax:
PHP
Output:
where x and y are the other two sides of the triangle.h = \sqrt{x^2+y^2}

hypot(x,y);Parameters used:
- x : the length of first side.
- y: the length of the second side.
Input : x=3, y=4 Output :5 Input :x=9, y=10 Output : 13.453624047074Below program illustrates the working of hypot() function in PHP:
<?php
// PHP code
// Calculating the value of hypotenuse
// With sides = 3,4
$hypotenuse = hypot(3,4);
print_r($hypotenuse);
// New Line
print_r("\n");
// Calculating the value of hypotenuse
// With sides = 4,6
$hypotenuse = hypot(4,6);
print_r($hypotenuse);
?>
5 7.211102550928Related Article: hypot() in C++