Send to a Friend

lefteh's avatar

How would I perform this operation on a string in PHP?

Asked by lefteh (9429points) January 27th, 2009

So, basically, I have a bunch of data in this form:

<li>
<h2>Title</h2>
When: Tue Feb 10, 2009 7:20am to 8am&nbsp;EST<br>
<br>Who: Author
<br>Where: Place
<br>Event Status: Status <br/>
</li>

(It’s a Google Calendar XML file).

And I want to display it with only the title and the date. The title is its own field in the XML file, so that’s fine. But the date is part of a lumped-together “summary” field, which contains the when, the who, the where, and the status. So what I want to do is add something in my PHP loop that will trim down that entire field to just the date. So in the above example, it would print like this:

<li>
<h2>Title</h2>
Feb 10, 2009<br>
</li>

What string operations could do this? I wrestled with preg_replace to no avail.

Using Fluther

or

Using Email

Separate multiple emails with commas.
We’ll only use these emails for this message.