I’m currently using the following PHP foreach code below. When I view the source code, it’s a giant block of list items.
My question is, how can I edit this so each list item in the source code is on it’s own line for easier debugging?
foreach($xml->Event as $event) {
echo '<li><a href="', $event->link, '">';
echo '<strong>', $event->title, '</strong>';
echo '<span>', $event->beginDate, ' at ', $event->beginTime, '</span>';
echo $event->location;
echo '</a></li>';
}
Like this:
Just add
. "\n"to the last line in your loop.