parse every other line
Posted: Fri Aug 26, 2005 9:30 am
I have this code that I am using to display some quotes on a page:
quotes.txt is done for every line right now, but it looks very messy. I want to make it easier to read by putting a space in between every quote, but then of course I get empty <li>'s.
I want to know how to parse every other line (starting with 1) so that it skips the empty lines. I know that might not be the only way, another might be just ignoring lines that contain only EOF or something. Ideas?
Thanks.
Code: Select all
<ul id="quotesul">
<?php
$file = "quotes.txt";
$Array = file($file);
foreach ($Array as $key => $val) {
echo "<li>";
echo $val;
echo "</li>";
}
?>
</ul>I want to know how to parse every other line (starting with 1) so that it skips the empty lines. I know that might not be the only way, another might be just ignoring lines that contain only EOF or something. Ideas?
Thanks.