Calculate the hypotenuse lengths of different right triangles:
<?phpecho hypot(3,4) . "<br>";echo hypot(4,6) . "<br>";echo hypot(1,3) . "<br>";echo sqrt(3*3 +4*4);?>The hypot() function calculates the length of the hypotenuse of a right triangle.
Tip: This function is equivalent to sqrt(x*x + y*y).
hypot( x,y );
parameter | describe |
---|---|
x | Required. Specifies the length of the first right-angled side. |
y | Required. Specifies the length of the second right-angled side. |
Return value: | The length of the hypotenuse. |
---|---|
Return type: | Float |
PHP version: | 4.1+ |