Skip to content

Instantly share code, notes, and snippets.

@oleksapro
Created December 20, 2016 09:49
Show Gist options
  • Save oleksapro/1af0afbfcf0ed0996765f5548678eafc to your computer and use it in GitHub Desktop.
Save oleksapro/1af0afbfcf0ed0996765f5548678eafc to your computer and use it in GitHub Desktop.
php
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