<?php

mb_internal_encoding('utf-8');

$text         = "А роза упала на лапу Азора";
$textlow      = mb_strtolower($text);
$textnospaces = str_replace(" ", "", $textlow);

$count     = mb_strlen($textnospaces);
$count     = $count / 2;
$halfcount = floor($count);

for ($i = 0; $i <= $halfcount; $i++) {
    $a = mb_substr($textnospaces, $i, 1);
    $b = mb_substr($textnospaces, -$i - 1, 1);
    echo "{$a} --- {$b}\n";
    if ($a != $b) {
        echo "{$text} - Это не палиндром.\n";
        break;
    }
    ;
    if ($i == $halfcount) {
        echo "{$text} - Это палиндром.\n";
    }
    ;
}
;



?>