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
> 

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to