<?php
mb_internal_encoding('utf-8');
$text = "поп";
echo $text;
 
$text = str_replace(" ","",$text);
$text = mb_strtolower($text);
 
 	$lenght = mb_strlen($text);
	$i = 0;
	$b = 0;
	while (mb_substr($text, $i, 1) == mb_substr($text, -$i -2, 1)){
		$i++;
		$b++;
	}
	if ($b == $lenght - 1){
		echo "Палиндром!";
	}
	else{
		echo "Не палиндром!";
	}