Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP hypot() Function

PHP hypot() Function

PHP Math Reference Manual PHP Math Reference Manual

Example

Calculate the hypotenuse length of different right triangles:

"; echo hypot(4,6) . "
"; echo hypot(1,3) . "
"; echo sqrt(3*3+4*4); ?>

Run Example »


Definition and Usage

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

**Tip:** This function is equivalent to sqrt(xx + yy).


Syntax

hypot(

x,y

);

Parameters Description
x Required. Specifies the length of the first leg.
y Required. Specifies the length of the second leg.

Technical Details

Return Value: The length of the hypotenuse.
Return Type: Float
PHP Version: 4.1+

PHP Math Reference Manual PHP Math Reference Manual