<?php

/**
 * Translates Latin characters to Cyrillic characters in a given subject.
 *
 * @param string $subject The subject to be translated.
 * @param bool $whitespace Flag to indicate whether to replace whitespace characters or not. Default is false.
 * @return string The translated subject with Cyrillic characters.
 */
function getCyrillicAlphabet($subject, $whitespace = false) {
	$search = ["A","a","B","E","e","M","H","O","o","P","p","C","c","T","X","x","I","i"];
	$replace   = ["А","а","В","Е","е","М","Н","О","о","Р","р","С","с","Т","Х","х","І","і"];

	if($whitespace){
		$search[] = " ";
		$replace[] = "‏‏‎‎ ";
	}

	return nl2br(str_replace($search, $replace, $subject));
}