0% found this document useful (0 votes)
15 views5 pages

PHP Math Functions Explained

The document provides an overview of various PHP mathematical functions including min(), max(), abs(), floor(), ceil(), round(), intdiv(), pow(), sqrt(), and rand(). It illustrates their usage with examples and highlights the performance difference between rand() and mt_rand(). Additionally, it mentions the Mersenne Twister Algorithm used in mt_rand().

Uploaded by

ahmaderfanroshan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views5 pages

PHP Math Functions Explained

The document provides an overview of various PHP mathematical functions including min(), max(), abs(), floor(), ceil(), round(), intdiv(), pow(), sqrt(), and rand(). It illustrates their usage with examples and highlights the performance difference between rand() and mt_rand(). Additionally, it mentions the Mersenne Twister Algorithm used in mt_rand().

Uploaded by

ahmaderfanroshan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

‫پښﺘﻮ‬ PHP

Math: Functions
PHP min() & max():

2, 8, 13, 50, 100, 1000, 4000

‫پښﺘﻮ‬ min(val1, val2,…..) max(val1, val2,…..)

min(array_value) max(array_values)
PHP abs(), floor(), ceil() & round():

abs() floor() ceil()


-20.4 20.4 50.5 50 80.3 81

‫پښﺘﻮ‬
round()
80.3 80
80.6 81
PHP intdiv(), pow(), sqrt():

4 8
2 8 intdiv(dividend, divisor)
0

‫پښﺘﻮ‬ (4)
3
pow(base, exp)
4 X 4 X 4 = 12

=2 sqrt(number)
PHP rand():

rand(min, max) mt_rand(min, max)


1 10 Mersenne Twister Algorithm
4 Times faster thean rand() function.

‫پښﺘﻮ‬
lcg_value()
0 1

You might also like