w3resource

PHP: sqrt() function

Description

The sqrt() function is used to create a square root of a number.

Version:

(PHP 4 and above)

Syntax:

sqrt(num)

Parameter:

Name Description Required /
Optional
Type
num The specified number. Required Float

Return value

The square root of num.

Value Type: Float.

Pictorial Presentation

php-math-abc()

Example:

<?php
echo sqrt(100);
echo'<br>';
echo sqrt(999);
echo'<br>';
echo sqrt(2.25);
echo'<br>';
?>

Output:

10
31.606961258558
1.5 

View the example in the browser

See also

PHP Function Reference

Previous: sinh
Next: srand



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/php/function-reference/sqrt.php