$pivot_point = intval(($left + $right)/2);
$pivot = $input_array[$pivot_point];
do
{
while(($input_array[$left] < $pivot) AND
($left <
$right_limit))
{
$left++;
}
while(($pivot < $input_array[$right]) AND
($right >
$left_limit))
{
$right—;
}
if($left <= $right)
{
//swap elements
$temp = $input_array[$left];
$input_array[$left] =
$input_array[$right];
$input_array[$right] = $temp;
$left++;
$right—;
}
}
while($left <= $right);
if($left_limit < $right)
{
Quicksort(&$input_array, $left_limit,
$right);
}
if($left < $right_limit)
{
Quicksort(&$input_array, $left,
$right_limit);
}
}
$data = array(6, 13, 99, 2, 33, 19, 84);