$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
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));
No, no, no,
php provides us with the native method: hypot()
echo hypot(3,4);//5 echo hypot(6,8);//10
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!