The most efficient way would probably be to execute the Unix command grep on your file using exec. Something like:
exec("grep -i stringtofind fileordirectorytosearch", $retarray);
e.g exec("grep -i happy ./text/data.txt", $retarray)
Then $retarray should contain the lines matched by grep in the file(s). However, this won't work if safe mode is on.
Another option would be to read the whole file into an array and use preg_grep() to returns the lines that match into a second array.
Obviously this may not be a good idea with a very large file !