.. More preg matches follow here for each tag ..
When a 'preg_match' matches on a line containing a tag, we
then save the contents of that tag into the 'current_story'
array, once we come back out of that story the now filled
array is added to the main 'storys' array to form a list of
stories found in the XML feed.
They're pretty much all the same, but the one that grabs the date deserves a little extra attention:
Rather than just assign the found text to a single variable,
we use two functions that are part of the series of
functions for handling text (These are detailed in the
strings part of the PHP manual). The 'explode' function
takes a sequence of characters and a string, and returns an
array of single strings, created by splitting the larger
string on the boundaries formed by the character sequence,
If $name = "Peter-#-Shaw", was used with
'$result = explode("-#-",$name)' then you would
end up with an array called 'result' that would
contain 'peter' in element  and
'shaw' in element .
The trim function just removes excess white space from the
ends of the input, so '$result = trim(" Peter Shaw
")' would make 'result' equal to just 'Peter Shaw',
we often use trim and explode together, especially in cases
such as above where the boundary is a single space, this
prevents empty slots in the array by removing any space from
the edges that does not constitute a separator between
In our script here, the time and the date of publication are
separated by a space, so we use 'trim' &
'explode' to separate them into two individual items
in the array.
Once we reach the end of this 'foreach' loop
that's the hard part of the script behind us, the rest is
just to display the results.
The next part down creates another array, this time from
This array holds the styles for the script to allow us to
use CSS inline to style the results. Now normally, you would
use a separate style sheet, and share it across the whole
site. Then use the HTML link tag, however in this case I was
reading the PHP manual chapter on the 'foreach'
function and I discovered something interesting