Вот может еще пригодится
function theend($string,$a,$b,$c)
{
$string=intval($string);
$p = substr($string, -2);
$end = $a;
if($p==2 || $p==3 || $p==4 || $p==22 || $p==23 || $p==24 || $p==32 || $p==33 || $p==34 || $p==42 || $p==43 || $p==44 || $p==52 || $p==53 || $p==54 || $p==62 || $p==63 || $p==64 || $p==72 || $p==73 || $p==74 || $p==82 || $p==83 || $p==84 || $p==92 || $p==93 || $p==94)
{
$end = $b;
}
if($p==1 || $p==21 || $p==31 || $p==41 || $p==51 || $p==61 || $p==71 || $p==81 || $p==91)
{
$end = $c;
}
return $string.' '.$end;
}
echo theend($total,'чатеров','чатаер','чатер');