There is a very quick and simple way to sort an array with version number keys in PHP.

Simply combine the power of uksort and version_compare:

$array = Array(  '1.2' => "version 1.2",   '1.0' => "version 1.0",   '2.0' => "version 2.0",);uksort($array, "version_compare");// Results:Array(  '1.0' => "version 1.0",  '1.2' => "version 1.2",  '2.0' => "version 2.0",);

Easy 🙂