PHP loves its arrays. Arrays are the uber-data structure. They're a list, a map, a stack, a queue, everything in one! Which is the problem.

Modern PHP grossly over-uses arrays. In most cases there are better options today, and when you find yourself reaching for "oh I'll just make this an associative array", stop. An extra 60 seconds of thought and code will often give you a more readable, faster, more memory-efficient, more flexible alternative. Classes, iterables, and collections can and should replace arrays in most of your day to day coding.

This talk will go through what PHP arrays actually are (hint: they are not, in fact, arrays at all), why they're so problematic, and what to do instead. By the end, you should find yourself (almost) never reaching for arrays to solve a problem.

Comments

Comments are closed.

John Boctor at 14:46 on 24 Apr 2024

Great talk and covered a lot of information. Went a bit fast, but that can't be helped when covering so much.

Joseph Lavin at 14:57 on 24 Apr 2024

(watched via. live stream). Great talk. Lot's of useful & applicable content + examples.

The jokes could be improved: I feel like I have... herd them... all before 🐘.

Great talk Larry, and thank you for all your work with PHP! Loved hearing an opinionated technical talk. Excellent arguments and valid points made to promote best practices with typing and classes.

Pace was too fast to keep up with while trying to understand the concepts and take notes, could slow things down a bit. The red font on black background was not readable on the projector screen.

This was one of the talks I was most excited to see, and Larry did not disappoint. I want this in a form I can easily share with everyone I've ever worked with.

I loved this. Will definitely use this in my code!

Susan Fung at 09:06 on 25 Apr 2024

I really enjoyed the talk. I will be taking this concepts back to work to use in my code.

Myles Hyson at 10:33 on 25 Apr 2024

I thought the title was a joke at first. When I realized it wasn't, and why, it gave me a lot to think about. I might have a hard time convincing my coworkers to not use arrays but I'm definitely going to give it a try.

Jack Naughton at 14:34 on 25 Apr 2024

I'm so glad to have something to point at in anger the next time I see a PR with a param named $data followed by 14 isset() checks