PHP snippet: Sort array on child array’s key value

April 10th, 2012

I have found myself digging for this code a few times recently. I figured I would just add it to the “easy access pile”. It’s a great way to sort an array of associative arrays… by one of the associative array key values.

function cust_sort($a,$b) {
	return strtolower($a['name']) > strtolower($b['name']);
usort($dealers, 'cust_sort');
Tags: , , , ,

One Comment:

Comments have been closed for this post. If you would like to ask a question or need help, please post in the forums.