How to Get the First Value In An Array Using PHP When You Don’t Know the Keys

Arrays are like that crazy uncle who gets a little too drunk at Christmas and starts telling inappropriate jokes at the dinner table.

You love ‘em… but you hate ‘em.

You can efficiently store and grab tera-tons of data with them… but when you just want to get the value of the 2nd element in the 3rd dimension of one… you feel like you gotta break out the code-jitsu to get at it.

Have no fear! Captain JMO is here!

I just cranked out a new video for you showing you several different ways to get at different keys and values in an array.

Technically, I made it to get at the FIRST value in an array WHEN you don’t know what the keys will be. But, you can use these functions and fancy combinations thereof to get a whole slew of data in your arrays.

Plus, I slipped in a little advice on why seeing the several different methods I used is important even if you already know how to do this.

Hint: I squash those know-it-all developers egos like annoying little mosquitos.

Anyway, here’s the link… judge for yourself:

And, if you’d give ol’ JMO a like I’d appreciate it!

Oh and the source code is available on Patreon for the ever-awesome folks who support the show. (Hint: Be awesome. Join them.)

P.S. If you liked the show, give it a like and share with the communities and people you think will benefit. And, you can always find all my tutorials, podcast episodes and more on johnmorrisonline.com, @jpmorris on Twitter and youtube.com/johnmorrisvideo.

Subscribe to the Podcast


Originally published at John Morris.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.