Generating Random Numbers in PHP, Random Number Function with PHP, Learn to Generate Random Numbers

In this PHP programming lesson we take a look at Generating Random Numbers in PHP, Random Number Function with PHP, Learn to Generate Random Numbers. This lesson is based on Codecademy’s free Learn PHP course. We are currently in the “Intro to Built-In PHP Functions” section, this lesson is, Generating Random Numbers. In this lesson, we learn about a new PHP built-in function that we can use to generate random numbers. We learn that we are able to generate random numbers using the rand() function in PHP. The rand() function allows us to generate a random number between the numbers that we specify and pass into our function arguments. Learn to Generate Random Numbers in PHP to truly begin to add randomness to your programs. Practice generating random numbers and use them in different coding examples to understand the different use cases for generating random numbers in PHP. We learn that the rand() function will return a random integer. If we invoke rand() without passing in any arguments, then the function will return a number between 0 and the largest number our environment allows. We are able to find out what this number is using the getrandmax() function. Learning to generate random numbers is key to becoming an awesome PHP developer. Make sure to practice generating random numbers and thanks for watching Generating Random Numbers in PHP, Random Number Function with PHP, Learn to Generate Random Numbers.