<?php
function getRightEnding($number, $setOfEndings) {
$t = $number % 10;
switch($t) {
case 1:
return $setOfEndings[0];
case 2:
case 3:
case 4:
return $setOfEndings[1];
default:
return $setOfEndings[2];
}
}
function myfunc($name) {
$nameLenght = strlen($name);
return ucfirst($name) . ' (В нике ' . getRightEnding($nameLenght, ['буква', 'буквы', 'букв']) . ')';
}
$callable = 'myfunc';
echo $callable('jahak');