PHP Exercise and solutions: Displaying string palindrome – codzhub

Displaying string palindrome

Sample Solution:

PHP Code:

<?php
function check_palindrome($string) 
{
  if ($string == strrev($string))
      return 1;
  else
	  return 0;
}
echo check_palindrome('madam')."\n";
?>

Sample Output:

1

Leave a Reply

Your email address will not be published. Required fields are marked *