Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #32873 : file_get_contents appends \n
User Name
REGISTER NOW! Mark Forums Read

sponsored links

1 25th March 20:08
External User
Posts: 1
Default #32873 : file_get_contents appends \n

ID: 32873
Updated by:
Reported By: mbm at interflow dot dk
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: FreeBSD 5.2
PHP Version: 5.0.3
New Comment:

The echo shell command does this by default.
Use "echo -n" to prevent it.

Previous Comments:

[2005-04-28 20:17:06] mbm at interflow dot dk

When loading a file with file_get_contents theres an \n appended to the

Reproduce code:
echo "foo" > file.txt
php -r 'var_dump(file_get_contents("file.txt"));'

Expected result:
string(3) "foo"

Actual result:
string(4) "foo


Edit this bug report at
  Reply With Quote

  sponsored links


Thread Tools
Display Modes

Copyright 2006 - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -