PHP Math functions

Mathematics ( or math ) functions are frequently used in our scripts. There are PHP math functions to take care of addition subtraction multiplication and many other mathematical requirements.

We will discuss these math functions and try to develop some sample codes on these to further understand on how to use these functions.
FunctionDetails
abs()Absolute value of a number
ACOS()Arc Cos value of Radian input
ASIN()ARc Sin value of Radian input
COS()Cos value of Radian input
deg2rad()Convert Degree value to Radian
EXP()Value of e raised to the power of input value
max()Maximum value from array or group
min()Minimum value from array or group
LOG()Log value with different Base
LOG10()Log value with Base 10
LOG1P()Log value with input added by 1
PI()Constant value PI() & M_PI
POW()Exponential value of a Base
round()Rounded value of a number
rand()Random number generator
rad2deg()Convert radian to degree
SIN()Sin value of Radian input
TAN()Tangent value of Radian input


Addition subtraction multiplication & Division

These simple scripts are easy to understand and develop. Let us try with some sample code using these basic mathematical functions. Read More

Generating Random Number

In any game or while generating passwords we use random number generators to give us random numbers. Read More


Formatting numbers

We can format numbers by specifying number of decimal places or use comma ( , ) to mark thousand places or use any other marks in our number formattingRead More

Next higher or lower number by using ceil & floor

What is the next higher number in hundredth place of 745 ? it is 800 by using ceil function. Same way 700 is the floor value of 745. Read More

Modulus or reminder of a division

We can get the modulus of two number by using modulus ( % ) function. Read More

Subscribe to our mailing list

* indicates required
Subscribe to plus2net
Visitors Rating
Your Rating


Google+

Post Comment This is for short comments only. Use the forum for more discussions.




Subscribe to our mailing list

* indicates required
Subscribe to plus2net
HTML . MySQL. PHP. JavaScript. ASP. Photoshop. Articles. FORUM Contact us
©2000-2017 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer