<?php
header("Content-Type: text/plain; charset=utf-8");
$text = 'А муза рада музе без ума да разума';
$halfLenght = floor($length / 2);
for ($i = 1; $i <= $halfLenght; $i ++) {
$lastSymbol = mb_substr($text, $length - $i, 1); if (($firstSymbol == $lastSymbol) and ( $i == $halfLenght)) {
echo "Текст является палиндромом. \n";
} elseif ($firstSymbol != $lastSymbol) {
echo "Текст не является палиндромом. \n";
break;
}
}
PD9waHAKCmVycm9yX3JlcG9ydGluZygtMSk7Cm1iX2NoZWNrX2VuY29kaW5nKCd1dGYtOCcpOwpoZWFkZXIoIkNvbnRlbnQtVHlwZTogdGV4dC9wbGFpbjsgY2hhcnNldD11dGYtOCIpOwoKJHRleHQgPSAn0JAg0LzRg9C30LAg0YDQsNC00LAg0LzRg9C30LUg0LHQtdC3INGD0LzQsCDQtNCwINGA0LDQt9GD0LzQsCc7CgokdGV4dCA9IG1iX3N0cnRvdXBwZXIoJHRleHQpOwokdGV4dCA9IHN0cl9yZXBsYWNlKCIgIiwgIiIsICR0ZXh0KTsKJGxlbmd0aCA9IG1iX3N0cmxlbigkdGV4dCk7CiRoYWxmTGVuZ2h0ID0gZmxvb3IoJGxlbmd0aCAvIDIpOwoKZm9yICgkaSA9IDE7ICRpIDw9ICRoYWxmTGVuZ2h0OyAkaSArKykgewogICAgJGZpcnN0U3ltYm9sID0gbWJfc3Vic3RyKCR0ZXh0LCAkaSAtIDEsIDEpOwogICAgJGxhc3RTeW1ib2wgPSBtYl9zdWJzdHIoJHRleHQsICRsZW5ndGggLSAkaSwgMSk7CiAgICBpZiAoKCRmaXJzdFN5bWJvbCA9PSAkbGFzdFN5bWJvbCkgYW5kICggJGkgPT0gJGhhbGZMZW5naHQpKSB7CiAgICAgICAgZWNobyAi0KLQtdC60YHRgiDRj9Cy0LvRj9C10YLRgdGPINC/0LDQu9C40L3QtNGA0L7QvNC+0LwuIFxuIjsKICAgIH0gZWxzZWlmICgkZmlyc3RTeW1ib2wgIT0gJGxhc3RTeW1ib2wpIHsKICAgICAgICBlY2hvICLQotC10LrRgdGCINC90LUg0Y/QstC70Y/QtdGC0YHRjyDQv9Cw0LvQuNC90LTRgNC+0LzQvtC8LiBcbiI7CiAgICAgICAgYnJlYWs7CiAgICB9Cn0=