Join Kevin Skoglund for an in-depth discussion in this video Introducing PHP array_rand, part of Easy PHP Projects: Single-Serving Sites.
- In this chapter, we're going to use PHP to build…a single serving site that generates random phrases.…Back in the course introduction, I showed you an example…of a Random Phrase Generator.…And that was barackobamaisyournewbicycle.com.…It's a very simple website that became very popular…and all it does is take Barack Obama's name…followed by a randomly picked phrase in order to…generate a sentence.…It says something nice like, "Barack Obama loves…"your laugh."…Click another one, "Barack Obama left a comment…"on your blog."…We can just click the text, and it's a link.…
"Barack Obama helped you move a sofa."…And so on.…And they're kind of silly, but it's the same idea over…and over again, that it just generates a sentence using…PHP and displays it for us.…We're going to try to do something similar.…In the process of doing that, I also want to introduce you…to another PHP function called array_rand.…And it takes an argument that's an array…and it returns a random key from the array.…Now, notice, it's returning a random key,…
- 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.