<?php
function isPalindrome($str) {
$reversed = strrev($str);
return strtolower($str) === strtolower($reversed);
}
// Example usage:
$result = isPalindrome('level');
echo $result ? 'Palindrome' : 'Not a Palindrome';
?>
<?php
function isPalindrome($str) {
$reversed = strrev($str);
return strtolower($str) === strtolower($reversed);
}
// Example usage:
$result = isPalindrome('level');
echo $result ? 'Palindrome' : 'Not a Palindrome';
?>
Related
Create a PHP script that uses sessions to store and display user information. |
Write a PHP script that calculates the factorial of a given number. |
Create a PHP script that processes a form submission and displays the submitted data. |
Create a PHP function to count the number of vowels in a string. |
How to check whether a given year is a leap year using php. |
How to get the largest element in an array of numbers |
Create a PHP script that prints the current date and time. |
Write a PHP function that throws a custom exception if a condition is not met. |