<?php
error_reporting(-1);
mb_internal_encoding('utf-8');
$text = "А роза упала на лапу Азора";
$result = 'палиндром';
$text = mb_strtolower($text);
$text = str_replace(" ", "",$text);
$lenght = mb_strlen($text);
//echo "{$lenght} \n";
$halflenght = floor($lenght/ 2);
//echo $halflenght, "\n";
$text = preg_split('//u', $text, null, PREG_SPLIT_NO_EMPTY);
$x = count($text);
for($i = 0; $i <= $halflenght; $i++) {
	$x--;
	//echo $i, " ", $x, "\n";
	if ($text[$i] != $text[$x]){
	$result = "Не палиндром";
	break;
	}
}
echo $result ;