选择排序的php实现

<?php
function selection_sort(array $anArr
){        
    for(
$i 0;$i count($anArr); $i
++){        
        
$s $i
;        
        for(
$j $i 1;$j count($anArr);$j 
++){                        
            if(
$anArr[$j] < $anArr[$s
]){        
                
$s $j
;        
            }                        
        }        
        
swap($anArr[$i], $anArr[$s
]);        
    }        
    return 
$anArr
;        

?>
原文地址:https://www.cnblogs.com/fancing/p/1690806.html