Re: echo'ing a variable and cat'ing text

From: Date: Thu, 02 Mar 2006 18:16:33 +0000
Subject: Re: echo'ing a variable and cat'ing text
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-231358@lists.php.net to get a copy of this message
Adam Williams wrote:
John Nichel wrote:
Well, you're not telling fgets how much to read for one, and I'd do this a different way to begin with... if ( $file = file ( $filename ) ) {
    foreach ( $file as $line ) {
        if ( $file != "" ) {
            echo ( $line . "@mdah.state.ms.us" );
        }
    }
} else {
    echo ( "Couldn't open $filename" );
}
When I do that, I get: userabc @mdah.state.ms.ususerdef @mdah.state.ms.ususerxyz @mdah.state.ms.us so looks like I need to strip out the end-of-line (EOL) character somehow.
echo ( rtrim ( $line ) . "@mdah.state.ms.us\n" ); Take notice of the '\n' too. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 jnichel@dotcomholdingsofbuffalo.com

« previous php.general (#231358) next »