Chaining Spaceship

no-email (Damien Seguy), Damien Seguy
Sun, 18 May 2025 00:00:00 +0000

It is possible to chain several spaceship operations by using the coalesce operator ``?:``. When the first spaceship operator returns 1 or -1, its value is immediately used. On the other hand, when the operation leads to 0, the coalesce ``?:`` uses the else branch, where the second spaceship operator is used, to the same effect.
This expression here replaces a call to ``array_multi_sort()``.
And of course, literally chaining spaceships together is a very bad idea.