<?php

error_reporting(-1);
mb_internal_encoding('utf-8');
$text = "Абвгг вба";
$text = mb_strtolower($text);
$text = str_replace(" ", "", $text);
$lenght = mb_strlen($text);
$halfLenght = floor($lenght/2);
$numberOfMismatches = 0;
$text = " " . $text;
for ($i=1; $i<=$halfLenght; $i++) {
	if (mb_substr($text, $i, 1) != mb_substr($text, -$i, 1)) {
		$numberOfMismatches++;
	}
		}
if ($numberOfMismatches > 0) {
	echo "Это не палиндром.";
} else {
	echo "Да, палиндром.";
}