Join Kevin Skoglund for an in-depth discussion in this video Randomize data in PHP, part of Easy PHP Projects: Single-Serving Sites.
- [Voiceover] In this chapter, we're going to create…some single-serving sites which use random data.…To do that, we'll need to learn how to use PHP…to pick a random value.…Let's begin by looking at two examples…of single-serving sites that use random data.…One of them, we've already looked up before:…sometimesredsometimesblue.com,…and the other one is justflipacoin.com.…If you recall, sometimesredsometimesblue,…if we reload the page, sometimes it's blue…and then, if we reload it a few times,…eventually we get red and it's one of those two colors.…
It makes sense. That's the URL.…It's nice and simple.…It randomly picks one of these two colors.…Another good example of this is justflipacoin.com.…So, by going to this site, you hit reload,…it'll spin a few times, and finally pick…either heads or tails, just like you were flipping a coin.…It came up heads again for me.…Heads.…Let's see how long it takes me to get a tails.…Reload again.…Heads.…
Nope.…Getting a lot of heads.…There we are, there's a tails.…It also has a link here for flipping again, as well.…
- Finding and validating an IP address with PHP
- Parsing the HTTP request for browser details
- Comparing dates and times in PHP
- Randomizing data with PHP
- Styling page content dynamically
- Generating random sentences
Skill Level Beginner
1. What is My IP Address?
2. Browser Mirror
3. Is it New Years Yet?
4. Random Data and Styling
5. Random Phrase Generator
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.