Re: Inconsistent php sematics witrh trim() ... or can't trim() handle assignment with same variable?

From: Date: Tue, 16 Dec 2003 06:20:17 +0000
Subject: Re: Inconsistent php sematics witrh trim() ... or can't trim() handle assignment with same variable?
Groups: php.windows 
Request: Send a blank email to php-windows+get-22389@lists.php.net to get a copy of this message
I can't see a promlem with the trim() function. Try this: <?php $a = " test\n"; echo "***$a***"; $a = trim($a); echo "***$a***"; ?> output: *** test ******test*** I have tested with both php4 and php5 from cvs. - Frank > Just ran into this annoying thing today: > > > Why does this /NOT/ work to remove NL's: > > $AccNr = fgets($fp); > while ( !feof($fp) ) { > > $AccNr = trim($AccNr); /// trim() DOES NOT WORK HERE > $InsertStr = "insert into $UpLoadTable values ('$AccNr')"; > print "<pre>$i: Inserting: $InsertStr </pre>"; > ob_flush(); > mssql_query($InsertStr); > > $AccNr = fgets($fp); > } > > while this works just fine to remove NL's: > > $AccNR = trim( fgets($fp) ); // trim WORKS JUST FINE HERE > while ( !feof($fp) ) { > > $InsertStr = "insert into $UpLoadTable values ('$AccNr')"; > print "<pre>$i: Inserting: $InsertStr </pre>"; > ob_flush(); > mssql_query($InsertStr); > > $AccNr = trim( fgets($fp) ); // trim WORKS JUST FINE HERE > > } > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.windows (#22389) next »