PHP Math Functions Demonstration
This page demonstrates various PHP math functions with examples.
Absolute Value
Original Number: -42
Absolute Value: 42
Ceiling and Floor
Original Number: 4.567
Ceiling: 5
Floor: 4
Rounding
Original Number: 7.56789
Round to nearest integer: 8
Round to 2 decimal places: 7.57
Power and Square Root
Base: 5, Exponent: 3
Power: 125
Square root of 5: 2.2360679774998
Random Numbers
Random number between 1 and 100: 100
Maximum and Minimum
Array of numbers: 10, 56, 22, 1, 98, 43
Maximum: 98
Minimum: 1
Trigonometric Functions
Angle: 45 degrees
Sine: 0.70710678118655
Cosine: 0.70710678118655
Tangent: 1
Logarithmic Functions
Number: 10
Natural Logarithm (ln): 2.302585092994
Base-10 Logarithm: 1
Exponential Function
Number: 3
Exponential of 3 (e^x): 20.085536923188