Join David Powers for an in-depth discussion in this video Array dereferencing, part of PHP Tips, Tricks, and Techniques.
- [Narrator] Hi, I'm David Powers,…and welcome to this week's edition…of PHP Tips and Tricks,…designed to help you become a smarter,…more productive PHP developer.…This time, I'm going to look at a technique…known as array dereferencing.…But don't let that name put you off.…It's very simple.…It's also extremely useful.…In plain language, it's a direct way…of accessing a specific element of an array…returned by a function.…When you need only that element…rather than the whole array, it makes your code…shorter and easier to read.…
To show you how it works, I'm going to use…the built-in PHP function getimagesize…to get details of this image, hoover.jpg.…If you want to follow along, you can download…the exercise files for this video.…But the script is so simple you can probably type it…yourself and use one of your own images.…Getimagesize returns an array of up to seven values,…so we can use print_r to inspect it.…So let's do that by running this script…by loading the file into a browser.…
And here's that array.…The first two elements are the width…
Note: The exercise files are free to all members. The code is commented to enhance your learning, but you will need database connectivity for some files to run as intended.
Skill Level Intermediate
PHP: Managing Persistent Sessionswith David Powers2h 41m Intermediate
New this Week:
1. Weekly Episodes
- 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.