0

Possible Duplicate:
How do I remove  from the beginning of a file?

I suspect that this issue has been encountered before, but I can't find anything on it yet. I've tried editing the file various ways, but every time I still get this strange character in the first entry.

So I have a text file (.txt) which includes:

derek, drw

billy, william

gary, oaktree

Now, I call the file() function and then print like so:

<?php 
// read the file into an array called $users
$users = file('C:/private/filetest_02.txt');
?>
<pre>
<?php print_r($users); ?>
</pre>

But, then I receive this output:

Array

(

[0] =>  derek, drw
[1] => billy, william
[2] => gary, oaktree 

)

Why is this  character being displayed in the first entry of the array? What can I do to alleviate this? Thanks in advance to anyone who can shed some light on this issue.

Community
  • 1
  • 1
Derek W
  • 9,708
  • 5
  • 58
  • 67

1 Answers1

1

That is a UTF-8 byte order marker.

You need to modify the file to remove it.

Steve
  • 7,171
  • 2
  • 30
  • 52
  • How would one modify that? – Derek W Jan 12 '13 at 13:11
  • 1
    Use a text editor, such as notepad++ to save the file without a BOM. See http://stackoverflow.com/a/6986922/1517648 If you're using a Linux distro then editors such as `gedit` or `kate` might be able to do the same thing. – Steve Jan 12 '13 at 13:17
  • Thank you, it looks like I should start using notepad++. :) – Derek W Jan 12 '13 at 13:25