Random Numbers and Dates
PHP makes creating random numbers and dates very easy.
When to use
Anytime you need to generate a random number or echo out a date, use these functions.
PHP has many built in functions. Use them just like we called our own functions in the last video.
To create a random number between two numbers:
To create the date, say - the year:
To find a list of date parameters, check out the PHP documentation:
Hints & tips
- PHP has many built in functions
- rand() and date();
Lesson notes are only available for subscribers.