Yea, the manual is clear but honestly, don't know what the offset really meant since there is no definition or explaination of how the offset work. All I know the definition of the offset is 'To balance each other out'. Like a weighting scale where one weight is more than other and I would need to add a bit of a weight to the lightest part to offset the other. So, I knew that is not what the manual meant so don't know how exactly does it work since there's no explanation or example of it.
But now I understand when I saw your example, so I'll tweak the coding. I'll also have to customize the codes to check to see if the HTML's CDATA is returned or not as well as the XML's CDATA is returned or not. Oh boy! Thanks, Scott "Mike Ford" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 20 November 2003 17:39, 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... > > > > --snip-- > > $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); > > --snip-- > > The manual is perfectly clear -- the third parameter is the offset within the string of where to start searching, not an occurrence number or any other way of counting. And the return value of strpos() is also an offset within the string. So, assuming your CDATA segments are nested (which the above seems to imply), then: > > > $XML_Start = strpos($res_str, "<![CDATA[") + 9; > > $HTML_Start = strpos($res_str,"<![CDATA[", $XML_Start) + 9; > > $HTML_End = strpos($res_str, "]]>", $HTML_Start); > > $XML_End = strpos($res_str, "]]>", $HTML_End+3); > > If they're not nested, then the search order would need to be different (you need to look for substrings in the order in which they occur in the string as a whole) but the principle is exactly the same. > > Cheers! > > Mike > > --------------------------------------------------------------------- > Mike Ford, Electronic Information Services Adviser, > Learning Support Services, Learning & Information Services, > JG125, James Graham Building, Leeds Metropolitan University, > Beckett Park, LEEDS, LS6 3QS, United Kingdom > Email: [EMAIL PROTECTED] > Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php