PHP hypot

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

PHP : hypot() function

Description

The hypot() function is used to calculate the length of the hypotenuse of a right-angle triangle.

Version

(PHP 4 and above)

Syntax

hypot (nx,ny )

Parameter

Name

Description

Required /
Optional

Type

nx

Length of first side

Required

Float

ny

Length of second side

Required

Float

Return value

The length of the hypotenuse.

Value Type : Float.

Example :

  1. echo hypot(3,4) . "
    ";  

  2. echo hypot(3,5) . "
    ";  

  3. echo hypot(4,7) . "
    ";  

  4. echo hypot(2,6);  

  5. ?>   

Output :

5
5.83095189485
8.0622577483
6.32455532034