I give an idea to check a given string is palindrome or not in php. In php, we use the “.” symbol for concatenating two strings. First of all, we should calculate the given string by using strlen(). I am considering the variable $x=”AMMA”; Here the length of the string is 4. We can get the every character from its indexes of  $x[0], $x[1], $[2], $x[3]. Each index values gives A, M, M, A. Then we should concatenate from last index with its previous index values till  its  starting index values by using the for loop.

Ok, Let see program:

for($i=$m-1; $i>-1; $i–)
echo $n.”<br>”;

echo “Given string is palindrome”;



Given string is palindrome