In this video, you’ll learn how to sort multidimensional arrays in PHP. You’ll not only learn basic sorting using array_multisort(), but you’ll also see a more advanced custom function for sorting multidimensional arrays by a specific key.
Multidimensional arrays can be one of the more confusing parts about learning PHP, but this video will help you get your head around it and give you some tools for sorting your multidimensional arrays that are simple and straight-forward.
This Post Has 6 Comments
I've learnt a lot from your YouTube tutorials. You are awesome. Thanks.
Haha thanks! That’s what I like to hear! 🙂
hai john ! can i get the codes of your videos on youtube…
Hi John, I left a comment on your YouTube channel but wanted to thank you again. I was messing with an identical problem for a few days. Per my youtube comment, I had to add the keys as indices since the numerical indices were causing issues. Thank you again.
No problem. Like I said over there, thanks for watching and posting your tweaks.
Thanks John
How do I extend this to sort by multiple keys? e.g age, then name.
Colin