HomeMenu
Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

hypot

Description

The hypot of Math for PHP 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 y

<?

$x = 3;
$y = 4;

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

echo $return;
5

2 · same

<?

$x = 3;
$y = 4;

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

echo $return;
5