<?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 calculates the sum of digits in a given number. |
Create a PHP script that processes a form submission and displays the submitted data. |
Write a PHP script that calculates the factorial of a given number using an iterative approach. |
Create a PHP script that uses sessions to store and display user information. |
Create a PHP script that calculates and displays the area of a rectangle given its length and width. |
Write a PHP script that generates and displays a list of the first 10 Fibonacci numbers. |
Create a PHP script that prints the current date and time. |
Write a PHP script that connects to a MySQL database and fetches data from a table. |