ankitweblogic logo
W e b t u t o r i a l s

Define PHP

PHP Installation


PHP Case Sensitivity

PHP Variable

PHP Echo & Print

PHP Operators

PHP Receiving Input

PHP Decision Making

PHP Loops

PHP Jumping Statement

PHP Image Gallery

PHP Arrays

PHP File Upload

PHP String Functions

PHP Math Functions

PHP Functions

PHP Variable Scope

PHP Constant Variable

PHP Superglobals

PHP Form Validation

PHP Include Statement

PHP Filter

PHP File Handling

PHP Date Functions

PHP Cookies

PHP Session

PHP Send Emails

PHP Captcha

PHP-MySQL Connectivity

PHP MySQL Select

PHP MySQL Insert

PHP MySQL Delete

PHP MySQL Update

PHP MySQL Injection

PHP Math Functions

Built-in Math Functions available in PHP Version 4+ are:

Function Description
abs() Returns the absolute (positive) value of a number
ceil() Round numbers up to the nearest integer.
floor() Round numbers down to the nearest integer.
round() Round the number.
max() Returns the largest number from an array.
min() Returns the smallest number from an array.
sin() Return the sine value of a number.
cos() Return the cosine value of a number.
tan() Return the tangent value of a number.
Return the value of PI.
Generate random numbers.
mt_rand() function is 4 times faster than rand() function.
pow() Return x raised to the power y.
sqrt() Return the square root of a number.

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

Sin Function

echo(sin(90)); //return 0.89399 
echo(sin(90*(M_PI/180))); //return 1

Cos Function


tan Function


Pi Function

echo(pi()); //return 3.1415926535898 

Rand Function


Pow Function

echo(pow(2,10)); //return 1024

sqrt Function

echo(sqrt(25)); //return 5