PHP - hypot
Trieda
Metóda - hypot
(PHP 4 >= 4.1.0, PHP 5, PHP 7)
The hypot() function returns the hypotenuse from a right-angled
triangle. This function can be easily replaced by the Pythagorean theorem =>
sqrt(x*x + y*y).
Procedurálne
- function hypot (float $x, float $y) : float
Parametre
| Názov | Dátový typ | Predvolená hodnota | Popis |
|---|---|---|---|
| $x | float | The side of x. | |
| $y | float | The side of y. |
Mávratovej hodnoty
Vracia: float
The resulting hypotenuse.
Príklady
<?php
$x = 15;
$y = 20;
$z = hypot($x, $y);
echo ("The hypotenuse of a triangle is $z");
