Home > Backend Development > PHP Tutorial > How to use php sqrt function

How to use php sqrt function

藏色散人
Release: 2023-04-04 22:10:02
Original
8401 people have browsed it

PHP sqrt() means square root, that is, finding the square root of the parameters. The syntax is sqrt(X). where X represents the number for which the square root is to be taken.

How to use php sqrt function

#What does the sqrt function mean? How to use php sqrt function?

Function: Find the square root of the parameters.

Syntax:

sqrt(X)
Copy after login

Parameters: X represents the number for square root calculation.

Description: Returns the result of the square root of parameter X.

php sqrt() function usage example:

<?php
$i = 9;
$i = sqrt($i);
$j = 8;
$j = sqrt($j);
$k = -5;
$k = sqrt($k);
echo $i."*****".$j."*****".$k;
?>
Copy after login

Output:

3*****2.8284271247462*****NAN
Copy after login

This article is an introduction to the PHP sqrt function. I hope it will help you if you need Friends help!

The above is the detailed content of How to use php sqrt function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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