<?php

error_reporting(-1);
mb_internal_encoding('utf-8');

$text = "хух";
$noProb = str_replace(' ','',$text);
$downStr = mb_strtolower($noProb);

$length = mb_strlen($downStr);
$halfLength = floor($length/2);
$half1 = "";
$half2 = "";

for ($i = 0;$i <= ($halfLength);$i++){
	$half1 .= mb_substr($downStr ,$i,1);
}
for ($ad =$length;$ad <= ($halfLength);$ad--){
	$half2 .= mb_substr($downStr,$ad,-1);
}
echo " раз'$half1' два'$half2'";
if ($half1 = $half2){
	echo "палиндром";

}
elseif($half1 != $half2){
	echo "не палиндром";
}
