Home > Backend Development > PHP Tutorial > A very niche php method: hypot

A very niche php method: hypot

藏色散人
Release: 2023-04-09 22:20:02
forward
4966 people have browsed it

This article will introduce you to a niche php method: hypot. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to everyone.

A niche php method: hypot

How do we generally calculate the length of the hypotenuse of a right triangle?

$a = 3;
$b = 4;
echo sqrt($a * $a + $b * $b);
//或者
echo sqrt(pow($a,2) + pow($b,2));
Copy after login

No, no, no,

php provides us with the native method: hypot()

echo hypot(3,4);//5
echo hypot(6,8);//10
Copy after login

The above is the detailed content of A very niche php method: hypot. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
php
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template