Page Stats
Visitor: 408
PHP Math Functions
PHP Math Functions are use to perform some mathematical operations on integer and float values.
Abs() Function
echo(abs(10.5)); //return 10.5 echo(abs(-10.5)); //return 10.5
Ceil Function
echo(ceil(5.1)); //return 6
Floor Function
echo(floor(5.9)); //return 5
Round Function
echo(round(10.50)); //return 11 echo(round(10.49)); //return 10 echo(round(10.34726,2)); //return 10.35
Max Function
echo(max(array(33,67,23,78,47))); //return 78 echo(max(33,67,23,78,47)); //return 78
Min Function
echo(min(array(33,67,23,78,47))); //return 23 echo(min(33,67,23,78,47)); //return 23
Fmod Function
echo(fmod(5,2)); //return 1
Pi Function
echo(pi()); //return 3.1415926535898
Rand Function
echo(rand()); echo(getrandmax()); echo(rand(10,20)); //return random number between 10 and 20
Pow Function
echo(pow(2,10)); //return 1024
Sqrt Function
echo(sqrt(25)); //return 5
Sin Function
echo(sin(90)); //return 0.89399 echo(sin(90*(M_PI/180))); //return 1 after converting radian to degree
Cos Function
echo(cos(45)); echo(cos(90*(M_PI/180)));
Tan Function
echo(tan(45)); echo(cos(90*(M_PI/180)));