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?