On Sun, 12 May 2002, Steven Jarvis wrote: > I want to do the following: > > Big chunk of text is stored in variable $a. Paragraph breaks are > signalled by two line breaks.
How big is big? 100 lines? 10,000 lines? 1,000,000 lines? > I want to just extract the first paragraph (i.e., all the text up to the > first set of two line breaks) from $a. > > How would I do this? > > I tried exploding $a into an array, then doing a while loop inside a for > loop, but it was taking WAY too long to execute (it was timing out). > > Is there an easy way to do this that I'm just overlooking? The easiest would be $first_graf = substr($big_text, 0, strpos($big_text, "\n\n")); The manual is your friend. There's a function for almost anything. While you are eating your corn flakes in the morning you should be reading through them and filing them away in your brain. miguel -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php