I need to pass a string (in command line as, php test.php dad) and check whether its a palindrome or not. I dont know how to pass string argumnet to a function. please explain, sample code is given below,
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";
}
?>