Advertisement

08.14.2008 at 09:39AM PDT, ID: 23648770 | Points: 500
[x]
Attachment Details

Weird spacing in fgets

Asked by chappymcgee in PHP for Windows

Tags:

I am trying to do something very simple,  open a file, read a line, find the position of a string

while (!feof($file_handle))
{
$line = fgets($file_handle);
stripos ($line, "java");
}

I am having a very strange issue.  I noticed if I search for a single char stripos ($line, "j");  i get a return value.  As soon as I would add a second character, it would no longer work.  In testing, I decided to echo the lines of the file to the screen.  Every character has a space between it, on every single line.

Ex:   H T M L   x m l n s = " h t t p : / / w w w . w 3 . o r g / 1 9 9 9 / x h t m l "

The original file has no spaces like this.  I also tried writing the line to a seperate file, and there are no spaces.  I'm pretty sure this spacing issue is why I can't find my string position, but I have no idea why this would be happening.Start Free Trial
 
Loading Advertisement...
 
[+][-]08.14.2008 at 10:14AM PDT, ID: 22232166

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.14.2008 at 10:57AM PDT, ID: 22232577

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628