<?php
$text = "сказка";
$resultTrue = 'палиндром';
$resultFalse = 'не палиндром';
$halgLength = floor($length / 2);
for ($i = 0; $i < $halgLength; $i++) {
$symbol2 = mb_substr($text, -$halgLength + $i, 1); }
if ($symbol1 == $symbol2) {
echo "$resultTrue \n";
} else {
echo "$resultFalse \n";
}
IDw/cGhwCmVycm9yX3JlcG9ydGluZygtMSk7Cm1iX2ludGVybmFsX2VuY29kaW5nKCd1dGYtOCcpOwoKJHRleHQgICAgICAgID0gItGB0LrQsNC30LrQsCI7CiRyZXN1bHRUcnVlICA9ICfQv9Cw0LvQuNC90LTRgNC+0LwnOwokcmVzdWx0RmFsc2UgPSAn0L3QtSDQv9Cw0LvQuNC90LTRgNC+0LwnOwoKJHRleHQgPSBzdHJfcmVwbGFjZSgiICIsICIiLCAkdGV4dCk7CiR0ZXh0ID0gbWJfc3RydG9sb3dlcigkdGV4dCk7CgoKJGxlbmd0aCAgICAgPSBtYl9zdHJsZW4oJHRleHQpOwokaGFsZ0xlbmd0aCA9IGZsb29yKCRsZW5ndGggLyAyKTsKCmZvciAoJGkgPSAwOyAkaSA8ICRoYWxnTGVuZ3RoOyAkaSsrKSB7CiAgICAkc3ltYm9sMSA9IG1iX3N1YnN0cigkdGV4dCwgJGksIDEpOwogICAgJHN5bWJvbDIgPSBtYl9zdWJzdHIoJHRleHQsIC0kaGFsZ0xlbmd0aCArICRpLCAxKTsKfQoKCmlmICgkc3ltYm9sMSA9PSAkc3ltYm9sMikgewogICAgZWNobyAiJHJlc3VsdFRydWUgXG4iOwp9IGVsc2UgewogICAgZWNobyAiJHJlc3VsdEZhbHNlIFxuIjsKfSA=