<?php
$text = "А роза упала на лапу Азора";
$result = 'палиндром';
//echo "{$lenght} \n";
$halflenght = floor($lenght/ 2); //echo $halflenght, "\n";
$text = preg_split('//u', $text, null, PREG_SPLIT_NO_EMPTY
); for($i = 0; $i <= $halflenght; $i++) {
$x--;
//echo $i, " ", $x, "\n";
if ($text[$i] != $text[$x]){
$result = "Не палиндром";
break;
}
}
echo $result ;
PD9waHAKZXJyb3JfcmVwb3J0aW5nKC0xKTsKbWJfaW50ZXJuYWxfZW5jb2RpbmcoJ3V0Zi04Jyk7CiR0ZXh0ID0gItCQINGA0L7Qt9CwINGD0L/QsNC70LAg0L3QsCDQu9Cw0L/RgyDQkNC30L7RgNCwIjsKJHJlc3VsdCA9ICfQv9Cw0LvQuNC90LTRgNC+0LwnOwokdGV4dCA9IG1iX3N0cnRvbG93ZXIoJHRleHQpOwokdGV4dCA9IHN0cl9yZXBsYWNlKCIgIiwgIiIsJHRleHQpOwokbGVuZ2h0ID0gbWJfc3RybGVuKCR0ZXh0KTsKLy9lY2hvICJ7JGxlbmdodH0gXG4iOwokaGFsZmxlbmdodCA9IGZsb29yKCRsZW5naHQvIDIpOwovL2VjaG8gJGhhbGZsZW5naHQsICJcbiI7CiR0ZXh0ID0gcHJlZ19zcGxpdCgnLy91JywgJHRleHQsIG51bGwsIFBSRUdfU1BMSVRfTk9fRU1QVFkpOwokeCA9IGNvdW50KCR0ZXh0KTsKZm9yKCRpID0gMDsgJGkgPD0gJGhhbGZsZW5naHQ7ICRpKyspIHsKCSR4LS07CgkvL2VjaG8gJGksICIgIiwgJHgsICJcbiI7CglpZiAoJHRleHRbJGldICE9ICR0ZXh0WyR4XSl7CgkkcmVzdWx0ID0gItCd0LUg0L/QsNC70LjQvdC00YDQvtC8IjsKCWJyZWFrOwoJfQp9CmVjaG8gJHJlc3VsdCA7