Return to Snippet

Revision: 30684
at August 19, 2010 08:49 by jmiller


Initial Code
function orderBy($data, $field) {
	$code = "return strnatcmp(\$a['$field'], \$b['$field']);";
	usort($data, create_function('$a,$b', $code));
	return $data;
}

Initial URL

                                

Initial Description
Orders a multi-dimensional field (such as sorting multiple $orders by field 'id')

Initial Title
Sort a multi-dimensional field

Initial Tags
sort, array, order

Initial Language
PHP