Reply to Re: fread, explode, and eof problem

Your name:

Reply:


Posted by Joe on 10/16/06 00:54

This code is a bit cleaner than what I was using, but I'm still having
a similar problem. Now, the first quote in each file has an extra
character before the authors name. I could probably use ltrim to get
rid of the extra character if I knew what it was. How do I find what
character it is? In the HTML source it just shows up as a rectangle.


Pedro Graca wrote:
> Joe wrote:
> > and of course if their
> > is a [...] different [...] way of doing this I'm all ears
>
> I'd use file() instead of fopen(), fread(), feof(), fclose().
> I'd use arrays (I *love* arrays).
>
> <?php
> $quotes = array();
> $dir = opendir($lpath);
> while ($f = readdir($dir)) {
> if (preg_match('/\.txt$/', $f)) {
> $quotes = array_merge($quotes, file($lpath . '/' . $f));
> }
> }
> closedir($dir);
>
> ### Remove all blank entries from $quotes
> $quotes = array_diff($quotes, array("\n"));
>
> ###
> ### ATTENTION
> ### The $quotes array may have "holes"
> ### If you need the keys in order without "holes" uncomment the next line
> // $quotes = array_merge($quotes);
> ?>
>
>
> --
> File not found: (R)esume, (R)etry, (R)erun, (R)eturn, (R)eboot

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация