Why is preg_replace replacing only last occurance of target in string?
I am developing an authoring system that includes footnote functionality. The system stores data as htmlspecialchar s encoded html. Footnotes are numbered in the source without regard to where the footnote appears in the text. So, footnote 5 could preceed footnote 1 in the html. When its time to process the document for presentation I am re-assigning the footnote numbers so that they appear sequentially in the text. I am trying to do this using...