<?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 using an iterative approach. |
Write a PHP function that throws a custom exception if a condition is not met. |
How to prevent SQL Injection using php |
how to get response status in api using curl php? |
Write a PHP script that calculates the factorial of a given number. |
Create a PHP script that calculates the average of an array of numbers. |
How to check if a given number is a perfect number. |