|
Posted by Hilarion on 07/11/05 13:35
ScareCrowe wrote:
> Okay, I figured out that the file() func is adding the newline to the
> variable, so switch() is not matching.
> I have tried using trim(), rtrim(), str_replace() etc but none of these func
> will eliminate the newline
According to the manual trim and rtrim do remove newline chars, so you
probably have some errors in the code. Post it (the code) here, so we
could check what's wrong with it.
You could also use:
$lines = file( 'some_file.txt' );
for( $i=0; $i < count( $lines ); $i++ )
$lines[ $i ] = trim( $lines[ $i ] );
Hilarion
[Back to original message]
|