I have a file with multiple lines and I want to parse it into an array to split the file at each carriage return. I am not sure how to do it. I have used split() in the past; however, I am not sure how to do this for a whole file with multiple lines.
file() as sleipnir214 posts, will split the file into an array using the newline character as the delimiter (but keeping the delimiter at the end of each line).
when you say carriage return do you really mean the CR, or the LF or the combination of the two (CRLF)? if you mean anything other the the LF (alone) then you will need to use a combination of file_get_contents() and explode()
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.