案例按A-Z升序和0-9降序排序?

I have image arrays such as

    [Images] => Array
        (
            [0] => /var/www/httpdocs/images/products/detail/10396-alt-1.jpg
            [1] => /var/www/httpdocs/images/products/detail/10396-main-599.jpg
        )

    [Images] => Array
        (
            [0] => /var/www/httpdocs/images/products/category/10167-main-354.jpg
            [1] => /var/www/httpdocs/images/products/detail/10167-alt-1.jpg
            [2] => /var/www/httpdocs/images/products/detail/10167-alt-2.jpg
            [3] => /var/www/httpdocs/images/products/category/10168-main-361.jpg
            [4] => /var/www/httpdocs/images/products/category/10168-main-360.jpg
        )

That I would like to sort by basename, but also by alphanum in a specific way

I would always like the first 5 digits to be sorted by numerically after having the alpha sorted ascending (z-a) then also have the last digits sorted descending. How would I accomplish this?

Sample output should be like this

    [Images] => Array
        (
            [0] => /var/www/httpdocs/images/products/detail/10396-main-599.jpg
            [1] => /var/www/httpdocs/images/products/detail/10396-alt-1.jpg
        )

    [Images] => Array
        (
            [0] => /var/www/httpdocs/images/products/category/10167-main-354.jpg
            [1] => /var/www/httpdocs/images/products/category/10168-main-360.jpg
            [2] => /var/www/httpdocs/images/products/category/10168-main-361.jpg
            [3] => /var/www/httpdocs/images/products/detail/10167-alt-1.jpg
            [4] => /var/www/httpdocs/images/products/detail/10167-alt-2.jpg
        )
  1. Extract filename from path: 10396-main-599
  2. Split filename with '-' as a separator 10396,main,599
  3. Sort path using comparison function

    function is_path_less($split_path1,$split_path2){
      if($split_path1[0] == $split_path2[0]){
        if($split_path1[1] == $split_path2[1]){
          return $split_path1[2] < $split_path2[2];
        }else{
          return $split_path1[1] > $split_path2[1];
        }
      }else{
        return $split_path1[0] < $split_path2[0];
      }
    }
    

Where $split_path1 and $split_path2 are ["10396","main","599"] and ["10396","alt","1"]

The result will be:

["10396","main","599"]
["10396","alt","1"]