05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

function should return 1 if the first value is greater than the second, -1 if the first<br />

value is less than the second, and 0 if the values are the same for the purposes of your<br />

custom sort order.<br />

Example 5-3 is a program that lets you try the various sorting functions on the same<br />

data.<br />

Example 5-3. Sorting arrays<br />

<br />

<br />

<br />

<br />

Standard sort<br />

Reverse sort<br />

User-defined sort<br />

Key sort<br />

Reverse key sort<br />

User-defined key sort<br />

Value sort<br />

Reverse value sort<br />

User-defined value sort<br />

<br />

<br />

<br />

<br />

132 | Chapter 5: Arrays<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!