sounds like you just need sort()
<?php
$sortme = array( 10, 8, 17, 6, 22, 4, 3, 87, 1);
sort($sortme);
echo '<pre>';
print_r($sortme);
echo '</pre>';
echo 'First: '.$sortme[0];
?>
Result :
Array
(
[0] => 1
[1] => 3
[2] => 4
[3] => 6
[4] => 8
[5] => 10
[6] => 17
[7] => 22
[8] => 87
)
First: 1