There is a function of 'output endings':

function plural_type($n) {return ($n%10==1 && $n%100!=11 ? 0 : ($n%10>=2 && $n%10<=4 && ($n%100<10 || $n%100>=20) ? 1 : 2));} $_plural_msg = array('сообщение', 'сообщения', 'сообщений'); $_plural_piple = array('человек', 'человека', 'человек'); $_plural_comm = array('комментарий', 'комментария', 'комментариев'); $_plural_zap = array('запись', 'записи', 'записей'); 

Called for example as follows:

 echo 'В группе - '.$_plural_piple[plural_type($row["count"])]; 

For this business 4 arrays are created. But something does not give me rest. Is it somehow not optimized, or is it more rational to cram arrays inside the function plural_type ? Can you please tell how you can modify this function on the site?

    1 answer 1

    Well, I would just pass possible words to the function ..