Re: [PHP-WIN] Can you use file() and rtrim() together

2002-05-07 Thread blulagoon
A big thank you to Stuart who contributed . $myArray = @file('text_file'); foreach ($myArray as $key=>$val) { $myArray[$key] = rtrim($val, "\n"); } I can now go and play with my asfunction:myfunction param1|param2 which is what was being screwed by the line feeds. Blu. -- PHP Window

Re: [PHP-WIN] Can you use file() and rtrim() together

2002-05-07 Thread blulagoon
Sadly what Olivier suggests below doesn't work and generates the following error message .. Warning: Array to string conversion in d:\program files\apache group\apache\htdocs\..\products.php on line 10 It seems that rtrim is converting the array created by @file into a string. What I

Re: [PHP-WIN] Can you use file() and rtrim() together

2002-05-06 Thread Olivier Hubert
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