hypot

Calculate the length of the hypotenuse of a right-angle triangle

Hypotenuse is equivalent to sqrt(x*x + y*y).

Syntax

hypot ( float $x , float $y ) : float

Parameters

x

Length of first side

y

Length of second side

Return

Calculated length of the hypotenuse

Examples

1

<?

$x = 3;
$y = 4;

$return = hypot($x, $y);

echo $return;

?>
5

2

<?

$x = 3;
$y = 4;

$return = sqrt(($x * $x) + ($y * $y));

echo $return;

?>
5
HomeMenu