<?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'\n";

($half1== $half2) ?  $result = "Это палиндром" : $result = "Не палиндром";

echo $result;
 