barkster Posted July 16, 2008 Share Posted July 16, 2008 How do I detect a blank line in a text file? I'm trying to insert some text into an array each time it hits a blank line. For example, this would create array with three items in it --bof-- test text text2 text3 text4 text5 --eof-- Link to comment https://forums.phpfreaks.com/topic/115075-parse-text-file/ Share on other sites More sharing options...
effigy Posted July 16, 2008 Share Posted July 16, 2008 How big are these files? <pre> <?php ### You can change this to file_get_contents. $data = <<<DATA test text text2 text3 text4 text5 DATA; $pieces = preg_split("/\r?\n\r?\n/", $data); print_r($pieces); ?> </pre> Link to comment https://forums.phpfreaks.com/topic/115075-parse-text-file/#findComment-591767 Share on other sites More sharing options...
barkster Posted July 16, 2008 Author Share Posted July 16, 2008 the one I'm looking at now has 3700 lines(70kb). I'll see what I can do with it. Thanks Link to comment https://forums.phpfreaks.com/topic/115075-parse-text-file/#findComment-591802 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.