Math in PHP, has in-built math functions, which makes mathematical operations easier.

Math functionsDescription
absReturns absolute value
bindecConverts a binary into decimal number
expReturns e to the power of n (where n is given number)
is_nanChecks given value is number or not
is_finiteChecks given value is finite or not
is_infiniteChecks given value is infinite or not
maxReturns the highest value from given numbers
minReturns the lowest value from given numbers
octdecConverts a octal into decimal number
piGives the value of PI
powReturns the power of given number.
sqrtReturns the square root of given number.

abs

<?php
 $a = -20;
 echo abs($a);
?>

pi

<?php
 echo pi();
?>

pow

<?php
 $p = 3;
 $n = 20;
 echo pow($n, $p);
?>

sqrt

<?php
 $p = 3;
 $n = 20;
 echo sqrt($n, $p);
?>