<?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
How to check whether a given year is a leap year using php. |
How to reverses a given string using PHP. |
How to prevent SQL Injection using php |
Create a PHP function to count the number of vowels in a string. |
Create a PHP script that counts the number of occurrences of each word in a given sentence. |
Write a PHP script that checks if a given string is a valid email address. |
Write a PHP script that generates a random password of a specified length. |
Write a PHP script that calculates the factorial of a given number using an iterative approach. |