Documentation

Sort

Enable sorting a record based on its value.

The class can be used directly with PHP's

  1. usort and uasort.
  2. ArrayIterator::uasort.
  3. ArrayObject::uasort.

Table of Contents

Methods

__invoke()  : int
The class comparison method.
sort()  : Iterator
Sort an iterable structure with the class comparison method and maintain index association.

Methods

__invoke()

The class comparison method.

public __invoke(mixed $valueA, mixed $valueB) : int

The method must return an integer less than, equal to, or greater than zero if the first argument is considered to be respectively less than, equal to, or greater than the second.

Parameters
$valueA : mixed
$valueB : mixed
Return values
int

sort()

Sort an iterable structure with the class comparison method and maintain index association.

public sort(iterable<string|int, mixed> $value) : Iterator
Parameters
$value : iterable<string|int, mixed>
Return values
Iterator

        
On this page

Search results