Calculate the hypotenuse of different right-angle triangles in PHP

Description

The following code shows how to calculate the hypotenuse of different right-angle triangles.

Example


  /*from  w  w w.  j a v  a 2  s .c  o m*/
<?php
    echo hypot(3,4) . "<br>";
    echo hypot(4,6) . "<br>";
    echo hypot(1,3) . "<br>";
    echo sqrt(3*3+4*4);
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Development »




Environment
Error
Hash
Include
Locale
Math
Network
Output
Reflection
PHP Regular Expressions