Posted by Jason Wong on 03/03/05 16:06
On Thursday 03 March 2005 19:53, Foofy wrote:
> I'm writing a script that transfers files from a list file and saves
> them locally. M
>
> If I use values from the list for the filenames of the saved files, it
> appears that none of the files are saved 'cept for the last one. If I
> put the values in an array directly in the script file, all is well. I
> have confirmed that the values are different and I've tried other
> methods to load the file, such as fgets. Here is a simplified version
> of my script that has the same problem:
Thank you for helping others to help you by constructing a simplified
example.
> <?php
> $linklist = file('links.txt');
file() -> "... each element of the array corresponds to a line in the
file, with the newline still attached ..."
That's most likely your problem. The last line of your file most likely
does not have a trailing NL character that is why it is the only line
that works.
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
New Year Resolution: Ignore top posted posts
[Back to original message]
|