note 22267 added to function.split
| From: | kang at elpmis dot com | Date: | Wed, 12 Jun 2002 15:30:16 +0000 |
| Subject: | note 22267 added to function.split | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31744@lists.php.net to get a copy of this message | ||
This is a good way to display a comma delimited file with two columns. The first column is the
URL's description, the second is the actual URL.
<ul>
<?php
$fname="relatedlinks.csv";
$fp=fopen($fname,"r") or die("Error found.");
$line = fgets( $fp, 1024 );
while(!feof($fp))
{
list($desc,$url,$dummy) = split( ",", $line, 3 );
print "<li>";
print "<a href='$url'>$desc</a>";
print "</li>\n";
$line = fgets( $fp, 1024 );
}
fclose($fp);
?>
</ul>
--
http://www.php.net/manual/en/function.split.php
http://master.php.net/manage/user-notes.php?action=edit+22267
http://master.php.net/manage/user-notes.php?action=delete+22267
http://master.php.net/manage/user-notes.php?action=reject+22267