sortFiles.php
Table of Contents
Functions
- sortFiles() : void
- Sorts an array of SplFileInfo objects.
Functions
sortFiles()
Sorts an array of SplFileInfo objects.
sortFiles(array<string|int, SplFileInfo> &$files, callable|string|array<string|int, mixed> $sort[, string|null $order = 'asc' ]) : void
Parameters
- $files : array<string|int, SplFileInfo>
-
Array of files to sort (modified in‑place).
- $sort : callable|string|array<string|int, mixed>
-
One of:
- callable : custom compare function, ex:
fn(SplFileInfo $a, SplFileInfo $b): int
- string : single built‑in key
'name' | 'ci_name' | 'extension' | 'size' | 'type' | 'atime' | 'ctime' | 'mtime'
- array : ordered list of such keys for multi‑criteria sorting e.g. ['type', 'name'] or ['extension','size']
- callable : custom compare function, ex:
- $order : string|null = 'asc'
-
The direction of the sort method 'asc' (default) or 'desc'.