Skip to content
Advertisement

What sort algorithm does PHP use?

Internally speaking, which algorithm(s) does PHP use to implement the various sort functions it offers? It seems like the usort variants might use a different algorithm than the built in sorts, but I wanted to know.

Where would I even find this information?

Thanks!

Advertisement

Answer

You could find the information by looking at the php manual. http://php.net/sort says PHP uses an implementation of Quicksort. Failing that, you could always trudge through the PHP source code itself.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement