usort

usort -- Sort an array by values using a user-defined comparison function

Description

void usort ( array array, string cmp_function)

דוגמה 1 . usort( ) example



































הערה :

דוגמה 2 . usort( ) example using multi-dimensional array











הערה : במקום שם פונקציה , ניתן לספק גם מערך המכיל הכוונה לאובייקט ושם שיטה .

דוגמה 3 . usort( ) example using a member function of an object











אזהרה

The underlying quicksort function in some C libraries ( such as on Solaris systems ) may cause PHP to crash if the comparison function does not return consistent values .