The palindrome can be found in three stages.
- Apply strrev to the specified value
- After that, divide using str split.
- Use foreach after that to concatenate the split value.
Example
$a = "madam";
$b =  strrev($a);
    $string_reverse = str_split($b);
    $palin = '';
    foreach($string_reverse as $value){
        $palin.= $value; 
    }
    print $palin;
    if($a == $palin){
        print "<br>Palindrome";
    } else {
        print "<br>Not Palindrome"; 
    }
Output
madam
Palindrome