PHP hypot() Functie
Voorbeeld
Bereken de schuine zijde van verschillende rechthoekige driehoeken:
<?php
echo hypot(3,4) . "<br>";
echo hypot(4,6) . "<br>";
echo hypot(1,3) . "<br>";
echo sqrt(3*3+4*4);
?>
Definitie en gebruik
De functie hypot() berekent de hypotenusa van een rechthoekige driehoek.
Tip: Deze functie is gelijk aan sqrt(x*x + y*y).
Syntaxis
hypot(x,y);
Parameterwaarden
Parameter | Description |
---|---|
x | Required. Specifies the length of first side |
y | Required. Specifies the length of second side |
Technische details
Winstwaarde: | De lengte van de hypotenusa |
---|---|
Retourtype: | Vlot |
PHP-versie: | 4.1+ |
❮ PHP-wiskundereferentie