<?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
Write a PHP script that generates a random password of a specified length. |
Create a PHP script that prints the current date and time. |
Create a PHP script that processes a form submission and displays the submitted data. |
Create a PHP script that checks whether a given number is a prime number or not. |
How to get the largest element in an array of numbers |
how can i solve php header errors? |
Write a PHP function that throws a custom exception if a condition is not met. |
Write a PHP script that calculates the factorial of a given number using an iterative approach. |