<?php

error_reporting(-1);
$originaltext = 'Aaa BbB Ccc cc Cbb bA aa';
/*switching all the letters to the lowercase*/
$lowercasedtext = mb_strtolower($originaltext);
/*checking the lowercased text*/
echo "$lowercasedtext\n";
/*making the text without spaces*/
$empty = ' ';
for ($i=0; $i<=strlen($lowercasedtext);$i++) {if (mb_substr($lowercasedtext,$i,1) != $empty) {
    $without = $without.mb_substr($lowercasedtext,$i,1);
        }
    }
/*checking the text without spaces*/
echo "$without\n";
/*comparing the symbols from both ends*/
$half = floor(strlen($without)/2);
for ($ii=0; $ii <= $half; $ii++){ 
	if (mb_substr($without,$ii,1) == mb_substr($without, strlen($without)-$ii-1,1)) {
		echo "$ii th letter is checked\n";
/*checking whether the comparison is done all over the word*/
		if ($ii == $half){
					echo "this word is a fucking PALINDROME, congrats, m8";
		}
	}
    else {
    	echo "you dun goofd m8";
    	break;
    }
}

?>
