Created
May 13, 2013 10:22
-
-
Save najlepsiwebdesigner/5567393 to your computer and use it in GitHub Desktop.
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
<?php | |
/* return pluralized form of input type, with respect to amount | |
* | |
* @param string type - defines type, possible values are: "hodina", "kus", "mesiac" | |
* @return string pluralized type in slovak language | |
*/ | |
function pluralizeAmountSlovak($type, $amount){ | |
$amount = $amount * 1; | |
var_dump($type); | |
var_dump($amount); | |
$dictionary = array( | |
'hodina' => array ('hodina', 'hodiny','hodín'), | |
'kus' => array('kus', 'kusy', 'kusov'), | |
'mesiac' => array('mesiac', 'mesiace', 'mesiacov'), | |
); | |
if (is_array($dictionary[$type]) > 0) { | |
if ($amount == 1){ | |
return $dictionary[$type][0]; | |
} | |
else if ($amount > 1 && $amount < 5) { | |
return $dictionary[$type][1]; | |
} | |
else { | |
return $dictionary[$type][2]; | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment