Compare cyrillic letters with PHP

A few day ago a needed to compare some cyrillic words and letters with PHP. In the example I take last name and check if the last letter is cyrillic “a”.

function check_female( $last_name = "Иванова" ){

	if(strcmp(mb_substr(($last_name), -1,1,"UTF8"), "а") == 0){
		return 1;
	}else{
		return 0;
	}

}

Leave a Reply

Your email address will not be published. Required fields are marked *