Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
33 lines (31 sloc) 600 Bytes
<?php
/**
* phpē®—ę³•å®žęˆ˜.
*
* ꎒåŗē®—ę³•-选ꋩꎒåŗ
*
* @author TIGERB <https://github.com/TIGERB>
*/
/**
* 选ꋩꎒåŗ.
*
* @param array $value å¾…ęŽ’åŗę•°ē»„
*
* @return array
*/
function select_sort(&$value=[])
{
$length = count($value)-1;
for ($i=0; $i < $length; $i++) {
$point = $i;// ęœ€å°å€¼ē“¢å¼•
for ($j=$i+1; $j <= $length; $j++) {
if ($value[$point] > $value[$j]) {
$point = $j;
}
}
$tmp = $value[$i];
$value[$i] = $value[$point];
$value[$point] = $tmp;
}
return $value;
}
You canā€™t perform that action at this time.