Arrays\natcasesort()

transformer terminal accepts iterable returns Closure pure
() → (Iterable → string[])
At a glance — Case-insensitive natural-order sort. Keys preserved. Terminal.

Creates a Closure that sorts an array or iterable with a case-insensitive natural order algorithm.

/**
  * @return Closure(iterable<int|string, mixed>):mixed[]
  */
Arrays\natcasesort(): Closure

Returned Closure

When Arrays\natcasesort() is called, it returns the following Closure which can be used like a regular function.

/**
  * @param iterable<int|string, mixed> $source
  * @return mixed[]
  */
$function (iterable $source): array

Examples

Partial Application

This can be used to create a simple closure which can be used as a regular function.

$nat = Arrays\natcasesort();
print_r($nat(['IMG10', 'img2', 'IMG1']));
// ['IMG1', 'img2', 'IMG10']

Details

Arrays Functions

Releated Array sort Functions