Created
April 15, 2016 18:54
-
-
Save AntoscencoVladimir/9d782d038cd5b8d2f2c277f941936c04 to your computer and use it in GitHub Desktop.
Comments rus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Склонение комментариев | |
function plural_form($number, $after) | |
{ | |
$cases = array(2, 0, 1, 1, 1, 2); | |
echo $number . ' ' . $after[($number % 100 > 4 && $number % 100 < 20) ? 2 : $cases[min($number % 10, 5)]]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment