I have a text file containing paragraphs of text. I want to load it as a string in php and then collect all the email addresses into it as an array. However, how to initially load the contents of a text file as a string? Recounted, I have
$string = **WITHIN TEXT FILE " user@domain.com MIME-Version: bla bla bla user2@example.com "; $matches = array(); $pattern = '/[A-Za-z0-9_-] +@ [A-Za-z0-9_-]+\.([A-Za-z0-9_-][A-Za-z0-9_]+)/' preg_match($pattern, $string, $matches);
How to load text from a text file into a string variable?
Thanks in advance!
source share