我需要传递一个字符串(在命令行中,如php test.php爸爸)并检查它是否是回文。我不知道如何将字符串argumnet传递给函数。请解释,示例代码如下,
function Palindrome($string){
if (strrev($string) == $string){
return 1;
}
else{
return 0;
}
}
# I need to pass DAD as an argument in command line
$original = "DAD";
if(Palindrome($original)){
echo "Palindrome";
}
else {
echo "Not a Palindrome";
}
?>