I have a text file with these contents
00:00:00:23 You
00:00:01:04 would
00:00:01:10 not
00:00:01:20 believe
00:00:02:07 your
00:00:02:16 eyes
00:00:03:08 -
00:00:03:16 if
00:00:03:20 ten
00:00:04:01 million
00:00:04:13 fireflies
00:00:06:00 -
00:00:06:08 lit
00:00:06:17 up
00:00:07:01 the
00:00:07:04 world
00:00:07:13 as
Notice how between each timestamp there is a new line. If I do file_get_contents and print it it will display in the browser exactly as shown with new line as wanted. However, I want to get each new line as a separate array element. When I use file(), only one element with the whole txt file is returned, and even if I write
ini_set("auto_detect_line_endings", true);
at the start of the script, most of the lines are put in arrays but some are not. If I try to explode with the "\n" delimiter, well that doesn't work at all.
\r\n$text=iconv("UTF-8", "ISO-8859-1//IGNORE", $text);then break on new lineod -c your_file_name.txtto see if there are any weird line-break variations in your file - either\nfor unix,\rfor "classic" mac or\r\nfor windows.