This article mainly introduces the php Association array quick sorting method, which involves php array sorting techniques and is very useful, for more information about how to sort php associated arrays, see the following example. Share it with you for your reference. The details are as follows:
<? Php function qsort ($ a, $ f) {qsort_do (& $ a, 0, Count ($ a)-1, $ f);} function qsort_do ($, $ l, $ r, $ f) {if ($ l <$ r) {qsort_partition (& $ a, $ l, $ r, & $ lp, & $ rp, $ f); qsort_do (& $ a, $ l, $ lp, $ f); qsort_do (& $ a, $ rp, $ r, $ f );}} function qsort_partition ($ a, $ l, $ r, $ lp, $ rp, $ f) {$ I = $ l + 1; $ j = $ l + 1; while ($ j <= $ r) {if ($ f ($ a [$ j], $ a [$ l]) {$ tmp = $ a [$ j]; $ a [$ j] = $ a [$ I]; $ a [$ I] = $ tmp; $ I ++ ;}$ j ++ ;}$ x = $ a [$ l]; $ a [$ l] = $ A [$ i-1]; $ a [$ i-1] = $ x; $ lp = $ I-2; $ rp = $ I ;}?>
I hope this article will help you with php programming.