PHP hypot() Funktion
Beispiel
Berechnen Sie die Hypotenuse verschiedener rechtwinkliger Dreiecke:
<?php
echo hypot(3,4) . "<br>";
echo hypot(4,6) . "<br>";
echo hypot(1,3) . "<br>";
echo sqrt(3*3+4*4);
?>
Definition und Verwendung
Die Funktion hypot() berechnet die Hypotenuse eines rechtwinkligen Dreiecks.
Tipp: Diese Funktion entspricht sqrt(x*x + y*y).
Syntax
hypot(x,y);
Parameterwerte
Parameter | Description |
---|---|
x | Required. Specifies the length of first side |
y | Required. Specifies the length of second side |
Technische Details
Rückgabewert: | Die Länge der Hypotenuse |
---|---|
Rückgabetyp: | Schweben |
PHP-Version: | 4.1+ |
❮ PHP Math Referenz