Microsoft Word - Core PHP Programming Using PHP to Build Dynamic Web Sites

(singke) #1

Two other two sort functions, asort and arsort, work in a slightly different way.
They preserve the relationship between the index and the element. This is most useful
when you have an associative array. If the array is indexed by numbers, you probably do
not want to preserve their indices. On the other hand, what if you did? Listing 15.4
illustrates a possible scenario.


Listing 15.3 Using the sort Function

Free download pdf