Php Open file rather than adding array

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

$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>";

$file = file_get_contents('file.txt');
$words = preg_split('/[^a-zA-Z]/', $file, -1, PREG_SPLIT_NO_EMPTY); 
$result = array();

foreach($words as $word) {
    $result[] = $word;

Sponsor our Newsletter | Privacy Policy | Terms of Service