poe Posted March 5, 2007 Share Posted March 5, 2007 if i have an array like: Array ( [0] => Array( [id] => 64, [zone] => a, => blue ) [1] => Array( [id] => 17, [zone] => b, => grey ) [2] => Array( [id] => 232, [zone] => c, => yellow ) [3] => Array( [id] => 36, [zone] => a, => red ) [4] => Array( [id] => 178, [zone] => a, => white ) [5] => Array( [id] => 10, [zone] => c, => blue ) [6] => Array( [id] => 115, [zone] => a, => orange ) [7] => Array( [id] => 345, [zone] => a, => black ) [8] => Array( [id] => 19, [zone] => b, => green ) [9] => Array( [id] => 206, [zone] => a, => red ) ) i want to show items with the following criteria: only 'zone' a, 4 highest ranked based on 'id' (highest to lowest) so my result will be: [7] => Array( [id] => 345, [zone] => a, => black ) [9] => Array( [id] => 206, [zone] => a, => red ) [4] => Array( [id] => 178, [zone] => a, => white ) [6] => Array( [id] => 115, [zone] => a, => orange ) thanks chris Link to comment https://forums.phpfreaks.com/topic/41198-sort-array/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.