note 16471 deleted from function.explode by jimw
| From: | jimw@php.net | Date: | Fri, 07 Dec 2001 21:25:38 +0000 |
| Subject: | note 16471 deleted from function.explode by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22014@lists.php.net to get a copy of this message | ||
explode gave me a bit of trouble when I used it to convert a txt file to a list. The last element in
the array was null so I used strlen to filter it.
$list_of_exists = file_exists($list_of);
if ($list_of_exists)
{
$listname = ($list_of);
$listcon = fopen ($list_of, "r");
$contents = fread ($listcon, filesize ($listname));
fclose ($listcon);
$stuff = explode ("\r", $contents);
print "some html";
for ($k = "0"; $k < count($stuff); $k++) { if (strlen ($stuff[$k]) > 5){ print
"some html" . $stuff[$k]; }}
print "some html";
}
Hope this can be a help to someone... Miles B