$str = "Hello World";
$reversedStr = strrev($str);
echo $reversedStr; // 輸出:dlroW olleH
$str = "madam";
if($str == strrev($str)){
echo "Palindrome";
} else {
echo "Not Palindrome";
}
$originalStr = "abcdef";
$reversedStr = strrev($originalStr);
// 進(jìn)行其他操作
$str = "abcde";
$midPoint = strlen($str) / 2;
$leftPart = substr($str, 0, $midPoint);
$rightPart = substr($str, $midPoint);
if($leftPart == strrev($rightPart)){
echo "Symmetrical";
} else {
echo "Not Symmetrical";
}