On Thu, 20 Nov 2003, Scott Fletcher wrote:
> How exactly does the 3rd parameter option work.  I tried this but it
> doesn't work, so I don't know how exactly does it work...  There isn't
> detail information on the php.net website...

"The optional offset parameter allows you to specify which character in 
haystack to start searching. The position returned is still relative to 
the the beginning of haystack."

So if you are trying to find subsequent occurrences of the string, you'd
need to make the offset be greater than the last character you checked, or
you're going to keep getting the first occurrence.

>    $XML_Start = (strpos($res_str,"<![CDATA[",1)+9);
>    $HTML_Start = (strpos($res_str,"<![CDATA[",2)+9);
>    $HTML_End = strpos($res_str,"]]>",1);
>    $XML_End = strpos($res_str,"]]>",2);

If you're just trying to pull one bit of data out of a file, you might
want to look into regex for this purpose. If you're actually trying to
write a parser, I think you might do well to read up on how other parsers
work (like, using a stack). Anyway, don't do that, use an existing XML
parser.. unless you are on a learning quest.. then, by all means!

-- 
Kelly Hallman
//Ultrafancy/

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

Reply via email to