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



Follow us on Facebook and Twitter for latest update.