PHP Math Functions | getrandmax()| rand()
Notes:
PHP Mathematical Constants & Functions:
- To perform mathematical calculations easily PHP provides various mathematical functions and constants.
getrandmax():int
- Returns the largest random value that is possible to generate using rand() function
Ex:
echo getrandmax(); // 32767
rand():int
- Returns a random number between 0 and largest possible random value
Ex:
echo rand();
rand(minValue: int,maxValue: int):int
- Returns a random number between minValue and maxValue
Ex:
echo rand(1,10);
Interview Questions:
1. PHP stands for ______________
a. Hypertext Preprocessor
b. Preprocessor Hypertext
c. Personal Home Processor
d. Personal Hypertext processor
Ans: a