We can use a Bubble Sort for sorting.
The best-case performance of O(n). Otherwise, best-case == worse-case == average-case == O(n^2)
$Obj1 = array(20, 30, 10, 50, 40, 60, 100, 90, 80, 70);
$temp;
print_r($Obj1);
for ($i = 0; $i < sizeof($Obj1) - 1; $i++) {
for ($j = sizeof($Obj1) - 1; $j > $i; $j--) {
if ($Obj1[$j - 1] > $Obj1[$j]) {
$temp = $Obj1[$j-1];
$Obj1[$j-1] = $Obj1[$j];
$Obj1[$j] = $temp;
$temp = 0;
}
}
}
print_r($Obj1);