[thelist] PHP help with fopen (I think)

Tara Cleveland tara at taracleveland.com
Fri Mar 15 16:43:01 CST 2002

Whoo hooo!!!

Much yelling and shouting in jubilation.

Simon's suggestion wasn't quite perfect. It took me about 10 minutes to
figure out why nothing was printing on the screen - my bad - I've been
staring at the screen for too long and didn't notice that there was no
mechanism for printing out the results. Doh!

And the variable names were a little off. I had to switch

$bits = explode('.', $array); // Split on full stops


$bits = explode('.', $contents); // Split on full stops

And then it worked!!!! Yeee haw!!!

I've been trying to sort this out for hours and hours. I guess I couldn't
get the order of imploding and exploding right. And wasn't entirely sure
what each one did. Thanks for the comments on each line. They were *very*

Have a great weekend everyone.


Tara Cleveland
Web Design and Consulting

> From: Simon Willison <cs1spw at bath.ac.uk>
> Here's a simple way of doing that:
> $array = file('home.html'); // Read file into an array
> $contents = implode('', $array); // Stick the whole file together in to
> a single variable
> $contents = strip_tags($contents); // Get rid of HTML tags
> $bits = explode('.', $array); // Split on full stops
> $first_sentence = $bits[0].'.'; // Get first sentence and put a full
> stop on the end

More information about the thelist mailing list