Re: strpos() act funny when searching for "]]>"....
| From: | Scott Fletcher | Date: | Fri, 21 Nov 2003 17:12:45 +0000 |
| Subject: | Re: strpos() act funny when searching for "]]>".... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-170597@lists.php.net to get a copy of this message | ||
With a moment of studying to your comment, I am beginning to see why I am
having the problem. I add the 9 in the first two lines of code, so I didn't
realize that I would have encounter the problem if I didn't add the 9.
Well, I seem to have problem understanding the word, 'offset' to the
strpos() function because it is a bad choice of word but that is
understandable when I use this function the first time and not understand
it. Thanks for the clarification...
Scott
"Kelly Hallman" <khallman@ultrafancy.com> wrote in message
news:Pine.LNX.4.44.0311210836510.21943-100000@clove.wrack.org...
> On Fri, 21 Nov 2003, Scott Fletcher wrote:
> > Ah! Found the problem... It is probably a bug with strpos() because it
> > seem to get stuck in there and couldn't get out of it somehow. The
> > workaround the problem I did was just easily increment the $HTML_End by
1
> > and that fixed the problem. It look like this...
>
> You should avoid statements like "_____ doesn't work" (try "I can't
> get it
> to work" or "it doesn't work for me") and "It's probably a bug
> with"...
>
> Anyway, strpos() is working exactly like it's supposed to...
> Consider this code:
>
> $t = "** string string string";
> $l = strpos($t,"string"); // $l == 3
>
> Now, if you tell strpos() to start searching at offset 3 for the same
> exact string, it's going to find the same occurence because you're telling
> it to start looking exactly where it found it last time.
>
> So, naturally, you need to advance the character position by at least one
> to find subsequent occurences. This isn't a workaround. You had the bug.
>
> --
> Kelly Hallman
> // Ultrafancy