I seem to be having trouble with line endings. Here is what the script is suppose to do:
1. it is connected to an ftp server, and it gets the selected file from there, and puts it into a directory on the server which the script is on.
2. then, it is suppose to read the file, through fopen, and fread, and those file functions
3. then it is to return the string, and the function highlight_string($text) is used.
Now, my problem, however, is that, when it comes back and it is run through that highlight_string function, it goes as one big line, of course it wraps to other lines, but the only thing I can figure out is that there is something wrong with the line endings.
if I go into that file, cut all the code out of it, and paste it back in, it works fine.
is there some type of problem with line endings going into windows from some other system? I have tried a few things. I tried using file() and readfile, and I always get the same thing.
would it work if I cut off the line endings with trim, used file(), and added the line ending manually? for example:
Code: Select all
$filename = "C:/www/temp";
$result = file($filename);
$text = ""
foreach ($result as $line) {
$text .= trim($line)."\n";
}Brandon