I don't know if you pasted the code directly from source, but your problem might come from the fact that you're using "/n" instead of "\n".
What I recommend would be this: $myString = @file('text_file'); $myArray = rtrim($myString, "\n"); Note that for the second part, you might have to put \r and then \n (e.g. "\r\n") or simply no char specified. By default PHP will strip all whitespaces, tabs and end of line/NULL bytes when you use rtrim without a second parameter. You might want to give it a try. Hope this helps, Olivier Hubert At 13:23 2002-05-06 +0100, blulagoon wrote: >I don't know if this is the right way to go about what I'm trying to do. > >In a nutshell, I want to open a simple text file and load the file into >an array with each line represented by one element in the array. >Now $myArray = @file("my_text_file"); achieves 90% of what I want, but I >need to strip out the line feeds at the end of each line that are in the >original file. > >rtrim($myString, "/n") would seem to offer this functionality, but I >can't figure out the best way to use it with an array ? > >Anyone got this working, or is there another easier way to do it, >perhaps with a variant of file() which doesn't include the linefeeds >that I don't know about. > >Looking forwards to your input guys ..... > >Blu. > > >-- >PHP Windows Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php