$word = "malayal";
$pal = true;
for ($i = 0; $i < strlen($word)/2; ++$i, --$j) {
// skip spaces
while ($word[$i] === " ") {$i++;}
while ($word[$j] === " ") {$j--;}
echo "$word[$i]== $word[$j]\n";
if ($word[$i] == $word[$j]) {
$pal = true;
break;
}
}
if ($pal) print "yes"; else print "no";
JHdvcmQgPSAibWFsYXlhbCI7CgokaiA9IHN0cmxlbiAoJHdvcmQpLTE7CiRwYWwgPSB0cnVlOwoKZm9yICgkaSA9IDA7ICRpIDwgc3RybGVuKCR3b3JkKS8yOyArKyRpLCAtLSRqKSB7CgogICAgLy8gc2tpcCBzcGFjZXMKICAgIHdoaWxlICgkd29yZFskaV0gPT09ICIgIikgeyRpKys7fQogICAgd2hpbGUgKCR3b3JkWyRqXSA9PT0gIiAiKSB7JGotLTt9CgogICAgZWNobyAiJHdvcmRbJGldPT0gJHdvcmRbJGpdXG4iOwogICAgaWYgKCR3b3JkWyRpXSA9PSAkd29yZFskal0pICAgIHsKICAgICAgICAkcGFsID0gdHJ1ZTsKICAgICAgICBicmVhazsKICAgICAgICB9Cn0KCmlmICgkcGFsKSBwcmludCAieWVzIjsgZWxzZSBwcmludCAibm8iOwo=