📅  最后修改于: 2022-03-11 14:53:38.393000             🧑  作者: Mango
// take an array with some elements
$array = array('a','z','c','b');
// get the size of array
$count = count($array);
echo "";
// Print array elements before sorting
print_r($array);
for ($i = 0; $i < $count; $i++) {
for ($j = $i + 1; $j < $count; $j++) {
if ($array[$i] > $array[$j]) {
$temp = $array[$i];
$array[$i] = $array[$j];
$array[$j] = $temp;
}
}
}
echo "Sorted Array:" . "
";
print_r($array);