文字

ArrayIterator::uasort

(PHP 5 >= 5.2.0)

ArrayIterator::uasortUser defined sort

说明

public void ArrayIterator::uasort ( string $cmp_function )

Sort the entries by values using user defined function.

Warning

本函数还未编写文档,仅有参数列表。

参数

cmp_function

The compare function used for the sort.

返回值

没有返回值。

参见

  • ArrayIterator::uksort() - User defined sort
  • usort() - 使用用户自定义的比较函数对数组中的值进行排序

用户评论:

[#1] Massimiliano Arione [2015-11-05 15:35:55]

Even if documentation says that $cmp_function must be a string, this method works with a Callable also.
Example:

<?php

$iterator->uasort([$this, 'usort']);  // 'usort' here is a method in the same class

上一篇: 下一篇: