X
HOME HTML CSS JAVASCRIPT SQL PHP JQUERY ANGULAR XML ASP.NET MORE...
REFERENCES | EXAMPLES | FORUM | ABOUT

PHP hypot() Function

PHP Math Reference PHP Math Reference

Example

Calculate the hypotenuse of different right-angle triangles:

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

Run example »

Definition and Usage

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

Tip: This function is equivalent to sqrt(x*x + y*y).


Syntax

hypot(x,y);

Parameter Description
x Required. Specifies the length of first side
y Required. Specifies the length of second side

Technical Details

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


PHP Math Reference PHP Math Reference

Your suggestion:

Close [X]

Thank You For Helping Us!

Your message has been sent to W3Schools.

Close [X]
Search w3schools.com:

WEB HOSTING

UK Reseller Hosting

WEB BUILDING

Download XML Editor FREE Website BUILDER Free HTML5 Templates FREE Website Templates Free HTML Templates

SHARE THIS PAGE

facebook