Created
December 20, 2016 09:49
-
-
Save oleksapro/1af0afbfcf0ed0996765f5548678eafc to your computer and use it in GitHub Desktop.
php
This file contains hidden or 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 _n_ru($text_one,$text_two,$text_def,$number){ | |
$modulo_100 = $number % 100; | |
$modulo_10 = $number % 10; | |
if( 10 != $modulo_100 - $modulo_10 ){ | |
switch( $modulo_10 ){ | |
case 1: | |
return $text_one; | |
case 2: | |
case 3: | |
case 4: | |
return $text_two; | |
} | |
} | |
return $text_def; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment