Php Open file rather than adding array

Hello,
I’m trying to create this code to read a file, it works if I add an array(‘word’,’bob’,’cat’,’racecar’)
I would like it to get file content and then strip all characters and numbers and then out put the result into an array


<?php
$arr = file('words-list.php');
foreach($arr as $word) {
    $word = strtolower($word);
    $reverse = strrev($word); 
    if ($word == $reverse) {
        echo "<p style='color:green;'>";
        echo " $word is a palindrome </p>";
    } else {
        echo "<p style='color:red;'>";
        echo " $word is not a palindrome </p>";
    }
}
?>

Sponsor our Newsletter | Privacy Policy | Terms of Service