function quick_sort ($array
{
if (count$array)<=1) {
return $array
} else {
$pivot = $array[0];
$lesser = array();
$greater = array();
for ($i=1;$icount$array);$i++) {
if ($array$i]<=$pivot) {
$lesser[] = $array$i];
} else {
$greater[] = $array$i];
}
}
return array_mergequick_sort$lesser), array$pivot), quick_sort$greater));
}
}