function printWord(string $digits, array $letters) {
$chars = str_split($digits);
$flipped = array_flip($letters);
$result = '';
foreach ($chars as $char) {
$result .= $flipped[$char];
}
echo $result;
}
$testLetters = [
'ч' => 0,
'л' => 9,
'в' => 1,
'к' => 8,
'е' => 5,
'о' => 2,
];
printWord('0592158', $testLetters);