<?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. |
Create a simple PHP script that calculates the sum of all even numbers between 1 and 10. |
Write a PHP script that generates a random password of a specified length. |
Write a PHP script that sets a cookie with user preferences and retrieves it on subsequent visits. |
How to reverses a given string using PHP. |
How to get the largest element in an array of numbers |
Write a PHP script that calculates the factorial of a given number. |
Write a PHP script that calculates the sum of digits in a given number. |
