ID: 26352 Updated by: [EMAIL PROTECTED] Reported By: scott at abcoa dot com Status: Open -Bug Type: Website problem +Bug Type: Documentation problem PHP Version: Irrelevant New Comment:
This is a docbug. Previous Comments: ------------------------------------------------------------------------ [2003-11-21 12:11:56] scott at abcoa dot com Boy! Bad example I put down. --snip-- $HTML_End = strpos($res_str,"]]>",$HTML_Start); $XML_End = strpos($res_str,"]]>",$HTML_End); --snip-- Would cause the variable $HTML_End and $XML_End to have the save value. So, an better example would be --snip-- $HTML_End = strpos($res_str,"]]>",$HTML_Start); $XML_End = strpos($res_str,"]]>",($HTML_End+1)); --snip-- But you get the drift about the need for a better example and a better example to clarify the understanding of hte word, 'offset'. ------------------------------------------------------------------------ [2003-11-21 11:47:24] scott at abcoa dot com Description: ------------ Read the strpos() function at http://us3.php.net/manual/en/function.strpos.php and had some trouble with it for a while, it took me a while to better understand it because I never use this function before. There are two problem here. Problem #1: The word 'offset' is a bad choice of word because the definition of it can be anything to what anyone's interpretation of the definition. Like mine, I assumed that offset meant to cancel each other out but when playing around with the script, I then knew that is not what it meant so I had no idea of what it meant. This problem can be overcome by the Problem #2. Problem #2: There is no example script of a strpos() with the use of offset attribute. So, how about updating the webpage to include the example. That would help to reduce the confusion and struggling in the long run. An example of it would be like this but don't take my word for it and you can use a simplier example -- $res_str = "blah blah blah blah"; $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); --snip-- Thanks!! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=26352&edit=1
