Izpis števila komentarjev (ednina, dvojina, množina)
<?php
header('Content-Type: text/html; charset=utf-8');
function get_plural($comments, $singular, $dual, $plural){
if($comments == 1) {
return $singular;
}
elseif($comments == 2) {
return $dual;
}
else {
return $plural;
}
}
$comments = 1;
echo $comments.get_plural($comments, ' komentar', ' komentarja', ' komentarjev');
?>