Locked lesson.
About this lesson
Exercise files
Download this lesson’s related exercise files.
Random Numbers and Dates.docx59.1 KB Random Numbers and Dates - Solution.docx
59.1 KB
Quick reference
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.
Instructions
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:
echo rand(1,10);
To create the date, say - the year:
echo date('Y');
To find a list of date parameters, check out the PHP documentation:
http://php.net/manual/en/function.date.php
Hints & tips
- PHP has many built in functions
- rand() and date();
Lesson notes are only available for subscribers.