[PHP-DOC] pcre/constants.xml
Hi, could somebody please check the following paragraph in reference/pcre/constants.xml rows 59-63: If this flag is set, for every occuring match the appendant string offset will also be returned. Note that this changes the return value in an array where very element is an array consisting of the matched string at offset 0 and it's string offset into subject at offset 1. ... There are at least three typos (value_s_, _e_very, its instead of it's) and maybe ... string offset into subject ... isn't correct, too (?). Don't know how to correct and translate this last piece. Martin
Re: [PHP-DOC] pcre/constants.xml
Hi Martin, Am Mo, 2003-12-15 um 10.51 schrieb Martin Samesch: Hi, could somebody please check the following paragraph in reference/pcre/constants.xml rows 59-63: If this flag is set, for every occuring match the appendant string offset will also be returned. Note that this changes the return value in an array where very element is an array consisting of the matched string at offset 0 and it's string offset into subject at offset 1. ... There are at least three typos (value_s_, _e_very, its instead of it's) and maybe ... string offset into subject ... isn't correct, too (?). Jup, that seem to be typos. For a better understanding of the paragraph and a good translation, you may look at following example: ?php $s = 'PHP is doing PCRE'; $splitted = preg_split('/ /', $s, -1, PREG_SPLIT_OFFSET_CAPTURE); print_r ($splitted); ? What you get is: Array ( [0] = Array ( [0] = PHP [1] = 0 ) [1] = Array ( [0] = is [1] = 4 ) [2] = Array ( [0] = doing [1] = 7 ) [3] = Array ( [0] = PCRE [1] = 13 ) ) If you look at the output you should be able to see what PREG_SPLIT_OFFSET_CAPTURE does. Preg_split basically uses the pattern to split the subject up (as it regulary does). But with that option set you do not get one array with each offset carrying the matched values, but you get as many arrays as you have matches. In the example each array gives you the matched pieces (it's values) in offset 0 and at offset 1 you get the offset of this particiular string-match refering to the beginning ( $s{0} ) of the subject string. Maybe i'm confusing you more than you were before, but i gave a try :) -ali Don't know how to correct and translate this last piece. Martin
Re: [PHP-DOC] pcre/constants.xml
Hi Martin! rows 59-63: If this flag is set, for every occuring match the appendant string offset will also be returned. Note that this changes the return value in an array where very element is an array consisting of the matched string at offset 0 and it's string offset into subject at offset 1. ... There are at least three typos (value_s_, _e_very, its instead of it's) and maybe ... string offset into subject ... isn't correct, too (?). Don't know how to correct and translate this last piece. As far as I have seen, Ali explained the meaning quite well. Feel free to clean up the text both in regards of typos and understandability. An added example in the manual is benefical in such cases :) Have a happy holiday :) Goba
Re: [PHP-DOC] pcre/constants.xml
Hi Goba, Am Mo, 2003-12-15 um 18.10 schrieb Gabor Hojtsy: Hi Martin! rows 59-63: If this flag is set, for every occuring match the appendant string offset will also be returned. Note that this changes the return value in an array where very element is an array consisting of the matched string at offset 0 and it's string offset into subject at offset 1. ... There are at least three typos (value_s_, _e_very, its instead of it's) and maybe ... string offset into subject ... isn't correct, too (?). Don't know how to correct and translate this last piece. As far as I have seen, Ali explained the meaning quite well. Feel free to clean up the text both in regards of typos and understandability. An added example in the manual is benefical in such cases :) Hehe, i just took a look at the man-page of preg_split and saw an example being quite alike mine. I must have been influenced by this from some time ago i read it, and when Martin asked it somehow came back to my mind. So the example is just fine, there is only a change needed in the paragraph to clarify the use of that flag. Ali Have a happy holiday :) Goba