打开文本文件并使每一行成为数组中的新字符串元素[关闭]

In php, how can I open and read in a text file and make each line of type string and an element in an array?

My plan is then to use a foreach to travel through the array and use in_array() to look for words in the contents of the file.

Use file():

$lines = file('path/to/file');

foreach($lines as $line)
{

  //enjoy

}