unkwntech Posted July 27, 2008 Share Posted July 27, 2008 I have a function that I wrote some time ago to sort an array based on the value of a key, for example in this array: $error['0']['level'] = '0'; $error['1']['level'] = '1'; $error['2']['level'] = '1'; $error['3']['level'] = '0'; could be sorted to 0312. I know that must be a built-in PHP function to do this, and it is probobly faster then what I wrote. Quote Link to comment https://forums.phpfreaks.com/topic/116853-solved-sorting-an-array/ Share on other sites More sharing options...
.josh Posted July 27, 2008 Share Posted July 27, 2008 sort, usort Quote Link to comment https://forums.phpfreaks.com/topic/116853-solved-sorting-an-array/#findComment-600879 Share on other sites More sharing options...
unkwntech Posted July 27, 2008 Author Share Posted July 27, 2008 Looks like usort() is what I'm looking for. sort() only sorts my indexes. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/116853-solved-sorting-an-array/#findComment-600882 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.