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

From: Date: Mon, 15 Dec 2003 17:54:14 +0000
Subject: 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-22388@lists.php.net to get a copy of this message
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 }

« previous php.windows (#22388) next »