On Mon, 21 Oct 2024, 18:09 Morgan, <[email protected]> wrote:
> You can’t use:
> $sorted_datasets = array_map(sort(...), $datasets);
> You want
> $sorted_datasets = $datasets;
> array_walk($sorted_datasets, sort(...));
>
A warning: no one should ever use array_walk($sorted_datasets, sort(...));
as general-use script.
When sorting a 2d array in this fashion (only non-fatally executed with
numeric first level keys https://3v4l.org/HaU42), the first
level keys will
be used as the sorting flag while sorting each row. This means that
different rows may have different sorting flags applied -- effectively
corrupting the result. https://3v4l.org/FeIpj -- notice how
rows with keys
2, 5, and 10 are sorted as strings.
Mick
>