function NumberEnd number titles cases array return titles number 100

1
2
3
4
function NumberEnd($number, $titles) {
$cases = array (2, 0, 1, 1, 1, 2);
return $titles[ ($number%100>4 && $number%100<20)? 2 : $cases[min($number%10, 5)] ];
}