<?php
namespace Word;
/**
* Класс для работы со словами.
*
* @package default
* @author `Roman`
*/
interface WordInterface {
public function caseChange();
}
class Word implements WordInterface {
public function __construct($word) {
$this -> word = $word;
}
public function caseChange($charset = "utf-8") {
return mb_strtoupper(mb_substr($this -> word, 0, 1, $charset), $charset) . mb_substr($this -> word, 1, mb_strlen($this -> word, $charset) - 1, $charset);
}
}
//testing:
$myWord = "слово";
$Word = new Word($myWord);
$newWord = $Word -> caseChange();
echo $newWord;