ArrayIterator::uasort

(PHP 5 >= 5.2.0, PHP 7)

ArrayIterator::uasortSort with a user-defined comparison function and maintain index association

说锟斤拷

public ArrayIterator::uasort ( callable $cmp_function ) : void

This method sorts the elements such that indices maintain their correlation with the values they are associated with, using a user-defined comparison function.

Note:

If two members compare as equal, their relative order in the sorted array is undefined.

锟斤拷锟斤拷

cmp_function

锟节碉拷一锟斤拷锟斤拷锟斤拷小锟节o拷锟斤拷锟节伙拷锟斤拷诘诙锟斤拷锟斤拷锟斤拷锟绞憋拷锟斤拷帽冉虾锟斤拷锟斤拷锟斤拷锟斤拷锟接︼拷胤锟斤拷锟揭伙拷锟叫★拷冢锟斤拷锟斤拷诨锟斤拷锟斤拷 0 锟斤拷锟斤拷锟斤拷锟斤拷

callback ( mixed $a, mixed $b ) : int

锟斤拷锟斤拷值

没锟叫凤拷锟斤拷值锟斤拷

锟轿硷拷

  • ArrayIterator::asort() - Sort array by values
  • ArrayIterator::uksort() - Sort by keys using a user-defined comparison function
  • usort() - 使锟斤拷锟矫伙拷锟皆讹拷锟斤拷谋冉虾锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷械锟街碉拷锟斤拷锟斤拷锟斤拷锟�