I'm trying to get a very simple text file into an array in PHP. Here is a sample of the type of text files I'll be parsing through. Here is the code I am using to try to get it into an array. function parse_txt($file) { $handle = fopen($file, "r"); $content = fread($handle, filesize($file)); fclose($handle); $array = explode('\r\n', $content); return $array; } PHP: The way I understand newlines, the \r\n string should locate all carriage return/newlines and explode them. Any ideas why this isn't happening? Thanks!
1. \r,\n characters handled only in the double quoted strings, not in the single-quoted 2. You can use the file function instead of all of your code
Ah... Double quotes. Should'a figured it'd be something like that! Thanks for the recommendation for the file function. I'll check that out.