PHP hypot() function

Definition and Usage

The hypot() function calculates the length of the hypotenuse of a right triangle.

Syntax

hypot(x,y)
Parameter Description
x Required. Length of side x.
y Required. Length of side y.

Description

hypot() فونکشن will calculate the length of the hypotenuse of a right triangle based on the lengths of the two sides x and y. Or the distance from the point (x, y) to the origin. The algorithm of this function is equivalent to sqrt(x*x + y*y).

Example

<?php
echo hypot(2,3);
echo hypot(3,6);
echo hypot(3,6);
echo hypot(1,3);
?>

Output:

3.60555127546
6.7082039325
6.7082039325
3.16227766017