Voting

: min(two, eight)?
(Example: nine)

The Note You're Voting On

bakatamas at freemail dot hu
17 years ago
Dear mike at clear-link dot com!

I needed a case insensitive version of your function. It is still not perfect as I have to do something with country specific characters (öüóőúéáűíÖÜÓŐÚÉÁŰÍ)

function akisort(&$array,$valrev=false,$keyrev=false)
{
if ($valrev)
{
arsort($array);
}
else
{
asort($array);
};
$vals = array_count_values($array);
$i = 0;
foreach ($vals AS $val=>$num)
{
$first = array_splice($array,0,$i);
$tmp = array_splice($array,0,$num);
$tmp2 = array();
foreach($tmp as $key => $value)
{
$tmp2[] = $key;
$number = $value;
};
natcasesort($tmp2);
reset($tmp2);
print_r($tmp2);
unset($tmp);
foreach($tmp2 as $key => $value)
{
$tmp[$value] = $number;
};
if($keyrev)
{
$tmp = array_reverse($tmp, true);
};
$array = array_merge($first,$tmp,$array);
unset($tmp);
$i = $i+$num;
};
};

<< Back to user notes page

To Top